我有一个div和一个子div,它的文本我想定位到左下角。
我试图将“页边距:10%”应用到我的div中的文本中,但是整个图像正在得到“边距顶:10%”的应用。我怎样才能像我想要的那样对齐这些文字?
#slide1_div1{
height: 60%;
background-image: url(../images/Executive3.jpg);
background-size:100% 100%;
}
<div id="slide1_div1">
<div style="color:yellow;background-color:black;margin-top:10%;">
Room starting at just INR 1800
</div>
</div>
发布于 2015-12-19 12:48:23
你可以在里面使用“填充”:
<div id="slide1_div1">
<div style="color:yellow;background-color:black;padding-top:10%;">
Room starting at just INR 1800
</div>
</div>
发布于 2015-12-19 12:45:19
你在找这样的东西吗?https://jsfiddle.net/30gm2hdt/
<div id="slide1_div1">
<div style="color:yellow;background-color:black;margin-top:10%;position:absolute; bottom:0;">
Room starting at just INR 1800
</div>
</div>
css:
#slide1_div1 {
height: 60%;
width: auto;
background-image: url("http://placehold.it/350x150");
background-size:100% 100%;
position: relative;
}
https://stackoverflow.com/questions/34375113
复制