これは私が作りたいものです:http://www.prikachi.com/images/743/5697743V.png
しかし、私がそれを作ろうとすると、私はこれを手に入れます:http: //www.prikachi.com/images/742/ 5697742I.png
どうすればそれを可能にできますか?私はテーブルを使いません。
メトロをテーマにしたウェブページを作成する良い例がありますが、jQueryやJavaScriptは使いたくありません。同様の質問がある場合は申し訳ありませんが、見つかりません。ありがとう :)
style.css
@font-face{
font-family: OpenSans;
src: url("opensans-light.ttf");
}
body{
background-color: #260930;
font-family: OpenSans;
}
header{
color: white;
font-size: 48px;
}
footer{
text-align: center;
color: white;
font-size: 12px;
}
.content{
height: 80%;
overflow: hidden;
}
.content .items{
padding: 0 20px;
position: relative;
overflow: hidden;
}
.icons{
position: relative;
top: 50%;
left: 50%;
}
.box{
float: left;
position: relative;
margin: 8px;
padding: 8px;
background: #555;
text-decoration: none;
cursor: pointer;
overflow: hidden;
color: #fff;
background: #00a8ec;
z-index: 9;
width: 240px;
height: 128px;
}
.box:hover{
opacity: 0.85;
}
.box span{
color: white;
position: absolute;
left: 5px;
bottom: 5px;
font-size: 15px;
font-weight: normal;
z-index: 8;
}
.box img{
position: absolute;
left: 50%;
top: 50%;
margin-left: -32px;
margin-top: -32px;
z-index: 7;
}
.box img.cover{
position: absolute;
margin: 0 auto;
top: 0px;
left: 0px;
width: 100%;
z-index: 6;
}
.photos{
width: 512px;
height: 288px;
}
.width1{width: 120px;}
.height1{height: 120px;}
index.html:
<!DOCTYPE HTML>
<html>
<head>
<title>Metro theme site</title>
<link rel="stylesheet" href="style.css"/>
<meta charset="windows-1251"/>
</head>
<body>
<div class="content">
<div class="items">
<a href="#" class="box" style="background: #f58d00;">
<span>Firefox</span>
<img src="images/firefox.png" alt="" />
</a>
<a href="#" class="box" style="background: #d68a3a; top: auto;">
<span>About me</span>
<img src="images/aboutme.png" alt="" />
</a>
<a class="box photos" style="box-align: start;" href="#">
<span>Photos</span>
<img class="cover" src="http://www.hdwallpapersarena.com/wp-content/uploads/2012/04/HD-wallpaper-2.jpeg" alt="" />
</a>
<a href="http://www.facebook.com/megapro189" target="_blank" class="box width1 height1" style="background: #3b5a9b;">
<span>Facebook</span>
<img src="images/facebook.png" alt="" />
</a>
<a href="#" class="box width1 height1" style="background: #f21d1d;">
<span>Projects</span>
<img src="images/projects.png" alt="" />
</a>
<a href="#" class="box width1 height1" style="background: #00aaf1;">
<span>Skype</span>
<img src="images/skype.png" alt="" />
</a>
<a href="#" class="box width1 height1" style="background: #00aaf1;">
<span>Skype</span>
<img src="images/skype.png" alt="" />
</a>
<a href="#" class="box width1 height1" style="background: #00aaf1;">
<span>Skype</span>
<img src="images/skype.png" alt="" />
</a>
</div>
</div>
</body>
</html>