Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 尝试将图像粘贴到网格中_Html_Css_Css Grid - Fatal编程技术网

Html 尝试将图像粘贴到网格中

Html 尝试将图像粘贴到网格中,html,css,css-grid,Html,Css,Css Grid,我用1fr 1fr构建了一个网格,每个网格都是50%。 在左边我想得到标题和P的,在右边 我想设置IMG。我希望图像将粘贴到屏幕的右侧 而左边的大小将像一个页面。 我该怎么做 这是我的代码,用于带有图像的右框: ***css*** .grid > box2 { background-color: blue; border: 2.5px solid black; padding: 0.5em; image-width: 50%; float: right; } .grid > b

我用1fr 1fr构建了一个网格,每个网格都是50%。 在左边我想得到标题和P的,在右边 我想设置IMG。我希望图像将粘贴到屏幕的右侧 而左边的大小将像一个页面。 我该怎么做

这是我的代码,用于带有图像的右框:

***css***
.grid > box2 {

background-color: blue;
border: 2.5px solid black;
padding: 0.5em; 
image-width: 50%;
 float: right;
}
.grid > box2 img {
 width: 100%;
}

从你的描述中很难理解你的意思。也许你可以试着用代码笔模拟一下你的处境? 我想你的意思是,你可以试着将右边的图像设置为背景图像,然后将其固定到位

.rightSideStyles {
background-image: url("./path/to/your/img.png");
background-attachment: fixed;
}

请澄清您的具体问题或添加其他详细信息,以突出显示您所需的内容。正如目前所写的,很难准确地说出你在问什么。