Html Div 标签,如何用它们创建行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3059549/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:29:37 来源:igfitidea点击:
Div tags, how to create rows with them
提问by Daniel Kivatinos
How to you define a row in div tags
如何在 div 标签中定义一行
High level example in pseudo code:
伪代码中的高级示例:
[DIV TAGS LEFT] [DIV TAGS CENTER] [DIV TAGS RIGHT]
[WHAT GOES HERE?????]
[DIV TAGS LEFT] [DIV TAGS CENTER] [DIV TAGS RIGHT]
[WHAT GOES HERE?????]
[DIV TAGS LEFT] [DIV TAGS CENTER] [DIV TAGS RIGHT]
回答by kamal
this may work
这可能有效
<style>
.parent {
margin-bottom: 15px;
padding: 10px;
color: #0A416B;
clear:both;
}
.left, .center, .right{
float:left;
width:32%;
border:1px solid #CEDCEA;
padding:5px;
}
</style>
<div class="parent">
<div class="left">
Left
</div>
<div class="center">
center
</div>
<div class="right">
right
</div>
<div style="clear:both;"></div>
</div>
回答by drummondj
If I understand the question, you need this HTML structure:
如果我理解这个问题,你需要这个 HTML 结构:
<div class="row">
<div class="left"></div><div class="center"></div><div class="right"></div>
</div>
... and this CSS:
...还有这个CSS:
div.row {
clear:both;
}
回答by Ben Rowe
<div class="parent">
<div class="left">left</div>
<div class="center">center</div>
<div class="right">right</div>
</div>
styling:
造型:
.parent {
overflow: auto;
}
.parent>div {
float: left;
width: 33%;
}
This should give you what your looking for.
这应该给你你想要的东西。