我想把我的文章课程放在我的旁边。如果浏览器窗口的大小更改或更小(如在移动电话上),则居中应相应调整,模板应响应。
顺便说一句:我谈论我的三个“战争盒子”,你可以用“Gegner 1”,“Gegner 2”和周围的灰色背景来识别。如果屏幕宽度大于或者等于1200px,条款应并排,如果分辨率较小,它们应该动态调整,并且可以通过手机解决。
我怎么能这样做?
HTML:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Funfighter Alliance</title>
<link rel="stylesheet" href="/include/designs/FFA/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/include/designs/FFA/style.css" type="text/css" media="screen" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans|Roboto' rel='stylesheet' type='text/css'>
<script src="/include/designs/FFA/js/modernizr.js"></script>
<script src="/include/designs/FFA/js/respond.min.js"></script>
</head>
<body>
<!--Header mit Navigation-->
<header id="side-header-wrapper">
<section id="side-header">
<!--Logo + Logounterschrift-->
<a href="http://funfighteralliance.de"><img alt="Funfighter Alliance - Offizielle Projekt-Homepage" src="/include/designs/FFA/bilder/Logo-FFA.jpg"></a>
<p>Offizielle Projekt-Homepage</p>
<!--Navigation-->
<nav>
<h2 class="hidden">Navigation</h2>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="">News</a></li>
<li><a href="">Teams</a></li>
<li><a href="">Forum</a></li>
<li><a href="">Kontakt</a></li>
</ul>
</nav>
</section>
</header>
<!--Spacer mit Log-In-->
<section id="spacer">
<h2 class="hidden">Log-In</h2>
<div class="login">{_boxes_VTEC-LOGINH}</div>
</section>
<!--3 Boxen für den War-Content-->
<aside>
<h2 class="hidden">Our Matches</h2>
<!--Topmatch Team 1-->
<article>
<img class="topwar_picleft" alt="Logo 1" src="/include/images/teams/team1.png" />
<p class="bluebox_versus">versus</p>
<img class="topwar_picright" alt="Logo 2" src="/include/images/teams/team1.png" />
<div class="topwar_whitebox">
<p class="whitebox_teamleft">Gegner links</p>
<p class="whitebox_versus">VERSUS</p>
<p class="whitebox_teamright">Gegner links</p>
</div>
</article>
<!--Topmatch Team 2-->
<article>
<img class="topwar_picleft" alt="Logo 1" src="/include/images/teams/team1.png" />
<p class="bluebox_versus">versus</p>
<img class="topwar_picright" alt="Logo 2" src="/include/images/teams/team1.png" />
<div class="topwar_whitebox">
<p class="whitebox_teamleft">Gegner links</p>
<p class="whitebox_versus">VERSUS</p>
<p class="whitebox_teamright">Gegner links</p>
</div>
</article>
<!--Last Matches-->
<article>
<img class="topwar_picleft" alt="Logo 1" src="/include/images/teams/team1.png" />
<p class="bluebox_versus">versus</p>
<img class="topwar_picright" alt="Logo 2" src="/include/images/teams/team1.png" />
<div class="topwar_whitebox">
<p class="whitebox_teamleft">Gegner links</p>
<p class="whitebox_versus">VERSUS</p>
<p class="whitebox_teamright">Gegner links</p>
</div>
</article>
<br class="clear" />
</aside>
<!--Content mit dynamischen Inhalt (je nach Unterseite generiert)-->
<div id="post"> {EXPLODE}</div>
<!--Footer, am Ende der Seite-->
<footer> </footer>
</body>
</html>
CSS:
/*Allgemeine Definitionen*/
body {
background-color: #FFFFFF;
border-top: 5px solid #009CFF;
color: #272934;
font-family: 'Open Sans',sans-serif;
overflow-y: scroll;
position: relative;
}
p {
line-height: 25px;
margin: 5px 0;
}
a {
color: inherit;
text-decoration: none;
transition: color 0.5s ease 0s;
}
strong {
font-weight: bold;
}
img {
height: auto;
max-width: 100%;
}
.hidden {
clip: rect(1px, 1px, 1px, 1px);
position: absolute;
}
.clear {
clear: both;
}
/*Header*/
#side-header {
color: #444444;
font-family: 'Roboto',sans-serif;
margin: 0 auto;
max-width: 1200px;
position: relative;
width: auto;
}
#side-header-wrapper {
background-color: #E8E8E8;
background-image: linear-gradient(to top, #E8E8E8 0%, #FFFFFF 100%);
background-repeat: repeat-x;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
height: 81px;
padding-bottom: 20px;
padding-top: 10px;
}
#side-header p {
font-size: 14px;
margin-left: 107.5px;
}
/*Navigation*/
nav {
bottom: 0;
font-size: 20px;
position: absolute;
right: 0;
}
nav ul li {
display: block;
float: left;
padding: 3px 15px;
}
/*Spacer m. Login*/
#spacer {
color: #444444;
font-family: 'Open Sans',sans-serif;
font-size: 14px;
height: 70px;
position: relative;
}
.login {
max-width: 100%;
overflow: hidden;
}
/*War-Boxes*/
.topwar_bluebox {
background: none repeat scroll 0 0 #009CFF;
float: left;
font-size: 14px;
height: 95px;
margin-right: 45px;
width: 256px;
}
aside {
background: none repeat scroll 0 0 #808080;
margin: 70px auto 45px;
max-width: 1200px;
width: auto;
}
aside article {
width: 256px;
margin-right: 45px;
float: left;
font-size: 14px;
}
.bluebox_versus {
background: none repeat scroll 0 0 #FFFFFF;
float: left;
font-family: 'Open Sans',sans-serif;
height: 22px;
line-height: 25px;
margin: 40px 0 0 12px;
text-align: center;
width: 46px;
}
.topwar_picleft {
background: none repeat scroll 0 0 #FFFFFF;
float: left;
margin-left: 22px;
margin-top: 12px;
width: 72px;
}
.topwar_picright {
background: none repeat scroll 0 0 #FFFFFF;
float: right;
margin-right: 22px;
margin-top: 12px;
width: 72px;
}
.topwar_whitebox {
background: none repeat scroll 0 0 #FFFFFF;
float: left;
font-size: 11px;
font-weight: bold;
margin-right: 45px;
width: 256px;
}
.whitebox_teamleft {
background: none repeat scroll 0 0 #FFFFFF;
float: left;
margin-left: 22px;
max-width: 72px;
}
.whitebox_versus {
background: none repeat scroll 0 0 #EEEEF1;
color: #2099DC;
float: left;
font-family: 'Open Sans',sans-serif;
height: 14px;
line-height: 14px;
margin: 10px 0 0 13px;
text-align: center;
width: 44px;
}
.whitebox_teamright {
background: none repeat scroll 0 0 #FFFFFF;
float: right;
margin-right: 22px;
max-width: 72px;
}
/*Content*/
#post {
clear: both;
font-family: 'Open Sans',sans-serif;
line-height: 25px;
margin: 0 auto;
max-width: 1200px;
position: relative;
width: auto;
}
/*News*/
#news_headline {
border-top: 2px solid #009CFF;
max-width: 1200px;
padding-bottom: 7px;
padding-top: 14px;
}
.news_headline_kate {
background-color: #00A3FF;
float: left;
font-size: 11px;
height: 15px;
line-height: 15px;
max-width: 48px;
text-align: center;
}
.news_headline_title, .news_headline_title_1 {
display: inline-block;
font-weight: 700;
margin-top: -3.5px;
max-width: 250px;
overflow: hidden;
padding-left: 48px;
text-overflow: ellipsis;
white-space: nowrap;
}
.news_headline_title_1 {
max-width: 470px;
}
img.news_headline_writersgraphic {
height: 16px;
margin-top: -3.5px;
max-width: 17px;
position: absolute;
}
.news_headline_username {
font-size: 11px;
margin-left: 18px;
margin-top: -1px;
position: absolute;
}
.news_headline_datum {
color: #858A9F;
font-size: 11px;
margin-left: 171px;
margin-top: -1px;
position: absolute;
white-space: nowrap;
}
#news_content {
font-size: 14px;
margin-top: 12px;
padding-bottom: 12px;
}
#news_footer {
max-width: 1200px;
padding-bottom: 16px;
padding-top: 14px;
position: relative;
}
a.news_headline_comment {
background-color: #272934;
color: #FFFFFF;
float: left;
font-size: 11px;
height: 17px;
line-height: 17px;
max-width: 48px;
position: absolute;
text-align: center;
text-decoration: none;
top: 7px;
}
#news_headline, #news_content {
border-bottom: 1px solid #009CFF;
}
/*Footer*/
footer {
background: none repeat scroll 0 0 #333333;
clear: both;
height: 350px;
position: relative;
width: auto;
}
链接到我的代码的jsfiddle示例:Click me