[英]How to move div vertically down using CSS
I'm new to CSS and I'd like to move a div section down (pls see attached image below):我是 CSS 新手,我想向下移动一个 div 部分(请参见下面的附图):
How do I make the div.title "float down" so that it neatly settles to the bottom left corner of the main div (aqua coloured box).如何使 div.title “下浮”,使其整齐地落在主 div(浅绿色框)的左下角。
I've tried vertical-align but it doesnt work.我试过垂直对齐,但它不起作用。
给margin-top
div{margin-top:10px;}
You could make your blue div
position: relative
and then give the div.title
position:absolute;
你可以让你的蓝色
div
position: relative
然后给div.title
position:absolute;
and bottom: 0px
和
bottom: 0px
Here is a working demo.. http://jsfiddle.net/gLaG6/这是一个工作演示.. http://jsfiddle.net/gLaG6/
I don't see any mention of flexbox in here, so I will illustrate:我在这里没有看到任何提到 flexbox 的内容,所以我将说明:
HTML
HTML
<div class="wrapper">
<div class="main">top</div>
<div class="footer">bottom</div>
</div>
CSS
CSS
.wrapper {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.main {
flex: 1;
}
.footer {
flex: 0;
}
A standard width space for a standard 16px font is 4px.标准 16px 字体的标准宽度空间是 4px。
Source: http://jkorpela.fi/styles/spaces.html来源: http : //jkorpela.fi/styles/spaces.html
if div.title is a div then put this:如果 div.title 是一个 div 然后把这个:
left: 0;
bottom: 0;
Try this configuration:试试这个配置:
position to absolute
width to 100%
height to 100px
bottom to 10
background-color: blue
This can help actually move the div to the bottom.这可以帮助实际将 div 移动到底部。 Just modify accordingly.
只需相应修改即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.