用css访问和定位div

时间:2018-03-27 16:33:11

标签: html css

我有以下html代码,div包含4个额外的div:

 <body>

 <div id="main">
   <div class="one">

   </div>
   <div class="two">

   </div>
   <div class="three">

   </div>
   <div class="four">

   </div>
 </div>

 </body>

如何访问内部的4个div并将它们放在我喜欢的页面上?

我想要的布局是这样的:

enter image description here

我一直试图谷歌这个但却找不到任何有用的东西。

谢谢!

1 个答案:

答案 0 :(得分:-1)

在充分了解您的问题后,我试着给您一个答案。

&#13;
&#13;
UINavigationController
&#13;
section {}

.main {
  float: left;
  position: absolute;
  width: 400px;
  height: 100%;
  margin: auto 13%;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

.section1 {
  width: 40%;
}

.section2 {
  width: 40%;
}

.section1,
.section2 {
  margin: 0px;
  padding: 0px;
  padding: 0px 5px;
  float: left;
  position: relative;
  height: 80%;
}

.section3 {
  padding: 0px;
  /*border: 1px solid #cccccc;*/
  float: left;
  position: relative;
  width: 83%;
  margin: 5px 5px;
  height: 20%;
}

.section1 .inner-1 {
  float: left;
  width: 100%;
  height: 100%;
  border: 1px solid #000000;
}

.section2 .inner-1 {
  float: left;
  width: 100%;
  min-height: 30%;
  border: 1px solid #000000;
}

.section2 .inner-2 {
  float: left;
  width: 100%;
  min-height: 30%;
  border: 1px solid #000000;
  margin: 10px 0px 0px 0px;
}

.section3 .inner-1 {
  width: 100%;
  float: left;
  border: 1px solid #000000;
  width: 100%;
  height: 50%;
}
&#13;
&#13;
&#13;

希望它对您有所帮助。