我想使用不同顏色的DIV進行佈局......所以我在對齊頁面右側的3個DIV時遇到了問題,它必須如下所示:div1在div1之下的div2和div2之下的div3。DIV在div右對齊
div a1
div a5
div a6
這裏是我的html代碼:
<HTML>
<HEAD>
<TITLE>DIV</TITLE>
</HEAD>
<BODY>
<link rel="stylesheet" href="coloursCSS.css" type="text/css">
<div class="a2">two</div>
<div class="a1">one</div>
<div class="a5">five</div>
<div class="a6">six</div>
<div class="VerticalSpace"></div>
<div class="a3">three</div>
<div class="HorizontalSpace"></div>
<div class="a4">four</div>
</BODY>
</HTML>
和CSS代碼:
.a1, .a2, .a3, .a4, .a5, .a6
{
border: 4px solid;
}
.VerticalSpace, .HorizontalSpace
{
border: 0px;
float: left;
}
.a2
{
height: 250px;
float: left;
background-color:red;
width: 100%;
}
.a3
{
height: 100%;
float: left;
width: 20%;
background-color: #eeeeee;
}
.a4
{
height: 100px;
float: left;
width: 100%;
background-color: red;
}
.a1
{
height: 20%;
width: 23%;
float: right;
background-color:blue;
}
.a5
{
height: 20%;
width: 23%;
float: right;
background-color: yellow;
position:relative;
}
.a6
{
height:20%;
width: 23%;
float: right;
background-color: green;
}
不能100%確定你的意思是div1,div2和div3,因爲沒有這些類或標識符的div – Huangism 2014-10-30 19:35:54
對於我來說很難顯示我想要什麼而沒有圖片...... div1,div2和div3只是例如。 – Valeriu92 2014-10-30 19:37:14
我想'div1,div2,div3'就像:'div a1,div a5,div a6'哇... – 2014-10-30 19:37:47