Html 如何使用html div标签和css进行水平分割

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9349109/
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-28 22:38:07  来源:igfitidea点击:

How to make horizontal division using html div tag and css

htmlcsslayoutalignment

提问by rejo

I'm trying to make two horizontal divisons using <div>tag in html, but I couldn't make it. Can anyone help me make horizontal division using html and css with <div>tags?

我正在尝试使用<div>html 中的标签制作两个水平分区,但我无法做到。任何人都可以帮助我使用带有<div>标签的html 和 css 进行水平划分吗?

This is prototype

这是原型

采纳答案by Mahmoud Gamal

Set the floatproperty for each divto be matched, for example leftto each, give each of them enough width so that the parent contains them.

float为每个div要匹配的属性设置属性,例如left每个,给每个属性提供足够的宽度,以便父级包含它们。

DEMO

演示

回答by Vivek Chandra

<div id="firstDivistion" class="division"></div>
<div id="secondDivistion" class="division"></div>


.division{
  width:50%;
  height:100px;
  float:left;
}

回答by Nishchal Gautam

`<div style='float:left'>stuffs</div>
<div style='float:right'>stuffs</div>
<div style='clear:both'></div>`

Works well in every cases and is followed in many places...

在任何情况下都运行良好,并在许多地方得到遵循......