Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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 - Fatal编程技术网

Html 在同一行中的图像上重叠透明阴影

Html 在同一行中的图像上重叠透明阴影,html,css,Html,Css,我试图让某些阴影(在4或6之间,带有透明度)在网页的一行上重叠一些图像。 以下HTML代码垂直堆叠图像,而不是并排堆叠,透明阴影也是如此: <div class = "component" style = "width: 1000px; height: 751px; background: url(testimg.jpg)"> <div class = "temperature" style = "background-color: #B80000

我试图让某些阴影(在4或6之间,带有透明度)在网页的一行上重叠一些图像。

以下HTML代码垂直堆叠图像,而不是并排堆叠,透明阴影也是如此:

<div class = "component" style = "width: 1000px; height: 751px; background:             url(testimg.jpg)">
  <div class = "temperature" style = "background-color: #B80000; width: 500px; height: 751px; opacity: 0.6"></div>
  <div class = "temperature" style = "background-color: #680000; width: 500px; height: 751px; opacity: 0.6"></div>
</div>
<div class = "component" style = "width: 1000px; height: 751px; background: url(testimg.jpg)">
</div>


如何正确显示这些组件?

您需要将这些组件浮动到左侧:

<div class = "component" style = "width: 1000px; height: 751px; background:             url(testimg.jpg)">
<div class = "temperature" style = "float: left; background-color: #B80000; width: 500px; height: 751px; opacity: 0.6"></div>
<div class = "temperature" style = "float: left; background-color: #680000; width: 500px; height: 751px; opacity: 0.6"></div>
</div>
<div class = "component" style = "width: 1000px; height: 751px; background: url(testimg.jpg)">
</div>


请看这个JSFIDLE:

非常简单,谢谢。。如果图像超过屏幕的水平宽度,它们不会开始新的一行,而是能够水平滚动,有什么想法吗?在这种情况下,您可能需要删除
组件
类的
宽度:1000px
,但没有看到示例,我不确定您想要实现什么,尝试使用我发布的JSFIDLE,保存后我会回复您。