Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何创建两个div';A:It’下一个是谁_Html_Css_Angular - Fatal编程技术网

Html 如何创建两个div';A:It’下一个是谁

Html 如何创建两个div';A:It’下一个是谁,html,css,angular,Html,Css,Angular,我试着用左边的marging,但仍然不能用 <div style="width: 100%;"> <div height: 100px; background: green;"> Left Div </div> <div style="margin-left: 50%; height: 100px; background: blue;">

我试着用左边的marging,但仍然不能用

<div style="width: 100%;">
    <div  height: 100px;  background: green;"> 
        Left Div 
    </div>
    <div style="margin-left: 50%; height: 100px; background: blue;"> 
        Right Div
    </div>
</div>


您只需添加到第一个子浮动left和widt 50%,并为它们都提供显示内联块

这不是角度问题。默认情况下,
div
元素具有样式属性
display:block
,该属性将它们放置在自己的行/块上

div{
高度:100px;
宽度:100px;
边框:1px纯黑;
}
div1
第2部分
您可以使用flex

<div style="width: 100%; display:flex">
<div  height: 100px;  background: green; width:50%"> 
    Left Div 
</div>
<div style="margin-left: 50%; height: 100px; background: blue;width:50%"> 
    Right Div
</div>