我有一个奇怪的问题,我有麻烦.所以我一直在使用这个使用flexBox的原型html5模板.虽然我遇到了一个小问题.我正在通过将“justify-content”属性应用到父div来尝试到模板的侧边栏和内容区域的一个小空间.虽然它不是在边栏和内容区域之间添加空格.我不知道我做错了什么所以如果有什么可以帮助我,那将是伟大的.提前致谢!
这是我的html:
<!DOCTYPE html> <html lang="en"> <head> <Meta charset="utf-8"> <Meta name="viewport" content="width=device-width"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="../scripts/javascript/responsive_drop_down.js"></script> <link href="../css/protoflexcss.css" rel="stylesheet" type="text/css" media="screen"/> <title>Welcome to My Domain</title> </head> <body> <header> <h1>This is a placeholder <br /> for header</h1> </header> <nav class="main"> <div class="mobilmenu"></div> <ul> <li><a href="#">Home</a></li> <li><a href="#">Video</a></li> <li><a href="#">Pictures</a></li> <li><a href="#">Audio</a></li> <li><a href="#">Other Work</a></li> <li><a href="#">About Me</a></li> <li><a href="#">Contact Me</a></li> </ul> </nav> <div id="wrapper"> <article class="content-main"> <section> <h2>Heading goes here...</h2> <time datetime="2014-05-21T02:43:00">Officialy Posted On May 21<sup>st</sup> 2:35 A.M.</time> <p>Content will go here...</p> </section> </article> <aside> <p>More content soon...</p> </aside> </div> <footer> <div class="copyright"> <span>All rights reserved 2014.</span> </div> <nav class="foot"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Video</a></li> <li><a href="#">Pictures</a></li> <li><a href="#">Audio</a></li> <li><a href="#">Other Work</a></li> <li><a href="#">About Me</a></li> <li><a href="#">Contact Me</a></li> </ul> </nav> </footer> </body> </html>
这里是相关的css:
#wrapper { display: flex; flex-direction: row; justify-content: space-around; flex-flow: row wrap; flex: 1 100%; width:92.5%; align-self: center; padding-top: 3.5em; padding-bottom: 2.5em; margin: 0; } #wrapper article.content-main { flex: 6; order: 2; } #wrapper article.content-main section { background-color: rgba(149,21,130,0.61); border: 2px solid #c31cd9; padding: 0.9em; } #wrapper aside { flex: 1; padding: 0.4em; background-color: rgba(17,208,0.56); border: 2px solid #15d0c3; position: sticky; }