javascript - 使用 Section 和 Aside 的自定义布局

标签 javascript html css twitter-bootstrap visual-studio-2013

我希望 aside 位于右侧,section 位于左侧。一切都应该在空间的中间。

请看这个link

<!DOCTYPE html>
<html>
<head>
<style>
#main {
 width: 800px;
  margin: 0 auto; 
}

.righttt{
  position: relative;
  right: 0px;
  width: 200px;

}

section {

overflow: left;

}


</style>
</head>
<body>

    <header>
    <h1>City Gallery</h1>
    </header>

    <div id="main">
        <section>
        <h1>London</h1>
        <p>
        London is the capital city of England. It is the most populous city in the United Kingdom,
        with a metropolitan area of over 13 million inhabitants.
        </p>
        <p>
        Standing on the River Thames, London has been a major settlement for two millennia,
        its history going back to its founding by the Romans, who named it Londinium.
        </p>
        </section>

        <section>
        <h1>London</h1>
        <p>
        London is the capital city of England. It is the most populous city in the United Kingdom,
        with a metropolitan area of over 13 million inhabitants.
        </p>
        <p>
        Standing on the River Thames, London has been a major settlement for two millennia,
        its history going back to its founding by the Romans, who named it Londinium.
        </p>
        </section>

        <aside class="righttt">
        <h1>London</h1>
        <p>
        London is the capital city of England. It is the most populous city in the United Kingdom,
        with a metropolitan area of over 13 million inhabitants.
        </p>
        <p>
        Standing on the River Thames, London has been a major settlement for two millennia,
        its history going back to its founding by the Romans, who named it Londinium.
        </p>
        </aside>    
    </div>

    <footer>
    Copyright © W3Schools.com
    </footer>

</body>
</html>

最佳答案

#wrapper {
    width: 100%;
    height: 100%;
}

#header {
    width: 100%;
    height: 50px;
    background-color: green;
}

#nav {
    width: 100%;
    height: 50px;
    background-color: red;
}

#section {
    width: 50%;
    height: 100px;
    background-color: yellow;
    float: left;
}

#aside {
    float: right;
    width: 50%;
    height: 200px;
    background-color: green;
}

#article {
    float: left;
    width: 50%;
    height: 100px;
    background-color: orange;
}

#footer {
    width: 100%;
    height: 50px;
    display: inline-block;
    background-color: blue;
}
<div id="wrapper">
    <div id="header">
        Header    
    </div>
    <div id="nav">
       Navigation
    </div>
    <div id="section">
        Section
    </div>
    <div id="aside">
        Section
    </div>
    <div id="article">
        Article
    </div>
    <div id="footer">
        footer
    </div>
</div>

关于javascript - 使用 Section 和 Aside 的自定义布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30503115/

相关文章:

javascript - SlideDown 功能需要点击两次才能工作

html - 根据返回的数据库值选中/取消选中复选框

javascript - 在整个代码中使用 AJAX 结果变量

javascript - 如何为每个动态 GridView 内容重定向到新屏幕?

javascript - 如何不使用每个 jquery 复制数组?

javascript - 如何覆盖 appendChild()?

javascript - 在输入文件上强制单击事件或打开选择文件窗口

html - float div 底部的对齐按钮

html - CSS 文件不会加载

jquery - 我怎样才能使 Logo 出现在向下滚动时出现的顶部固定菜单栏上,返回顶部时它应该消失?