Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.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 2个分区ID需要占用每个分区的半页_Html_Css - Fatal编程技术网

Html 2个分区ID需要占用每个分区的半页

Html 2个分区ID需要占用每个分区的半页,html,css,Html,Css,我在一个html文档中有两个div id,每个都有不同的背景颜色。我需要让每一张都占据整整一半的篇幅。因此,一半的页面将是一种颜色,另一半。。将是另一种颜色 -半垂直 -半水平 在css中执行此操作: html,body{ margin:0; padding:0; height:100%; width:100%; } #div_one{ height:100%; /*50 for other way */ width:50%; /*100 for other way *

我在一个html文档中有两个div id,每个都有不同的背景颜色。我需要让每一张都占据整整一半的篇幅。因此,一半的页面将是一种颜色,另一半。。将是另一种颜色

-半垂直

-半水平

在css中执行此操作:

html,body{
  margin:0;
  padding:0;
  height:100%;
  width:100%;
}

#div_one{
  height:100%; /*50 for other way */
  width:50%; /*100 for other way */
  background:#f00;
  float:left; /*or display:inline-block; */
}

#div_two{
  height:100%; /*50 for other way */
  width:50%; /*100 for other way */
  background:#00f;
  float:left; /*or display:inline-block;*/
}
然后在html中:

<div id="div_one"></div>
<div id="div_two"></div>


那么问题是什么?你的代码在哪里显示你到目前为止做了什么…你自己试过什么吗?不要期望我们编写您的代码,向我们展示您已经尝试过的内容,甚至可能有些代码(尽管已损坏)将第一个答案设置为标记,这样人们就不会浪费时间阅读问题并尝试回答每个人都必须从某个地方开始@Ruddy页面的一半我认为它像
高度:50%宽度:100%
如果你愿意,你可以这样做吗?我不会阻止你的@Ruddy@BeatAlex当前位置如果他愿意,他可以这样做,但是如果你只是想鼓励坏问题,那又有什么意义呢?(我更惊讶的是,你竟然想出了一个提问者一开始就认为是正确的答案。)很公平。但是,通过回答问题,你间接地告诉他们,发布糟糕的问题是可以的,因为他们仍然得到了答案。这就是为什么人们不喜欢回答糟糕的问题。