我有一个关于这个结构的幻灯片:
<div id="carousel">
<div class="slide">
<img>
<h3>caption</h3>
</div>
</div>Carousel具有背景渐变样式,但该渐变同时在图像和标题上运行。我希望它只经过图像,这样文本就会在顶部保持明亮的白色。
我在Drupal中工作,没有添加或更改div的特权。我尝试使用z-index,但一无所获。我尝试将背景样式移动到Slide和图像,但它不显示。
如何仅使用CSS对这些层进行重新排序?
谢谢!
发布于 2016-03-25 02:33:38
请检查以下内容:
<div id="carousel">
<div class="slide">
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg">
<h3>caption</h3>
</div>
</div>CSS:
#carousel{/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#87e0fd+0,53cbf1+40,05abe0+100;Blue+3D+%23+16 */
background: #87e0fd; /* Old browsers */
background: -moz-linear-gradient(top, #87e0fd 0%, #53cbf1 40%, #05abe0 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #87e0fd 0%,#53cbf1 40%,#05abe0 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #87e0fd 0%,#53cbf1 40%,#05abe0 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#87e0fd', endColorstr='#05abe0',GradientType=0 ); /* IE6-9 */
height:300px;width:600px
}
img{width:20%}JSFIDDLE:https://jsfiddle.net/m46doct1/4/
https://stackoverflow.com/questions/36207414
复制相似问题