我一直在关注这个教程视频,它清楚地展示了关于 css3 中灵活框的所有内容。我在 Mozilla 或 chrome 上没有任何问题。但是框位于 Internet Explorer 中部分框的正下方。可以在此处找到演示(如果您在 Mozilla 上查看,即可以看到差异)。这是我一直在玩的html代码:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> First html5 </title>
<link rel="stylesheet" href="mainnew.css" />
</head>
<body>
<div id="big_wrapper">
<header id="top_header">
<h1> Welcome to html5 </h1>
</header>
<nav id="top_menu">
<ul>
<li>Home</li>
<li>Tutorials</li>
<li>Podcast</li>
</ul>
</nav>
<div id="new_div">
<section id="main_section">
<article>
<header>
<hgroup>
<h1>Title of article</h1>
<h2>Subtitle for article!</h2>
</hgroup>
</header>
<p>This is the best article eva!</p>
<footer>
<p>- writtern by Emre Caglar </p>
</footer>
</article>
<article>
<header>
<hgroup>
<h1>Title of article2</h1>
<h2>Subtitle for article2!</h2>
</hgroup>
</header>
<p>This is the best article eva!</p>
<footer>
<p>- writtern by Emre Caglar </p>
</footer>
</article>
</section>
<aside id="side_news">
<h4>News</h4>
Emre has a new dog
</aside>
</div>
<footer id="the_footer">
Copyright mreonet 2012
</footer>
</div>
</body>
</html>
和CSS代码
body{
width:100%;
display:-webkit-box;
display: -moz-box;
display: box;
-webkit-box-pack:center;
-moz-box-pack:center;
box-pack:center;
}
#big_wrapper {
max-width: 1000px;
margin:20px 0px;
display:-webkit-box;
display: -moz-box;
display: box;
-moz-box-orient: vertical;
-webkit-box-orient: vertical;
box-orient: vertical;
-moz-box-flex: 1.0;
-webkit-box-flex: 1;
box-flex: 1;
}
#top_header {
background:yellow;
border: 3px solid black;
padding:20px;
}
#top_menu {
border:red;
background:blue;
color:white;
}
#top_menu li {
display:inline-block;
}
#new_div {
display:-webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient:horizantal;
-moz-box-orient: horizontal;
box-orient: horizontal;
}
#main_section {
border:1px solid blue;
margin:20px;
padding: 20px;
-moz-box-flex: 1.0;
-webkit-box-flex: 1;
box-flex: 1;
}
#side_news {
border:1px solid red;
width:220px;
margin:20px 0px;
padding:30px;
background:#66cccc;
我还注意到,当我在 ie8 上查看此页面时,它没有采用 css 样式。我对 html5 真的很陌生,可能会犯一些愚蠢的错误..
谁可以帮我这个事。顺便说一句,这是我的第一个问题,如果我错过任何事情,请告诉我并为此感到遗憾。