內容不會顯示在所有,或離開<section>
元素周圍的空白。部門元素不顯示任何內容和/或有空格周圍
這是與通過默認設置display: inline-block
風格做。所以我試圖通過在所有子元素上設置display: block;
來覆蓋該值,導致<section>
根本不顯示在網站上。
所以,我該如何把它弄到一起。並刪除空白。
下面是摘錄:
* {
margin: 0;
padding: 0;
}
header, section, footer, aside, nav, article, hgroup {
display: inline-block;
}
html {
height: 100vh;
}
body {
font-family: 'Archivo Narrow', sans-serif;
width: 100%;
height: 100vh;
}
html, body {
overflow: hidden;
}
/* Main Content Page */
main {
width: 100%;
height: 100vh;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
header {
width: 100%;
height: 18vh;
background-color: orange;
}
aside {
width: 20%;
height: 82vh;
background-color: orange;
}
section {
width: 79%;
height: 82vh;
background-color: darkgrey;
box-shadow: 5px 5px 5px inset;
}
<main id="content">
<header>
\t <h1>Just a random Header</h1>
</header>
<aside>
\t <p>Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text</p>
</aside>
<section>
\t <p>Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text</p>
\t <p>Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text</p>
\t <p>Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text</p>
\t <p>Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text, Just alot of Random Text</p>
</section>
</main>
奇怪的是,無論是片段或Codepen顯示這個問題,所以這裏是一個截圖顯示的問題,無論是在Firefox和Chrome:
你爲什麼不離開'寬度:80%'在PaulieD的回答'section'爲您剛纔的問題? –
在80%離開它意味着沒有在瀏覽器上都顯示,如果你看看上的評論有跡象表明截圖,這又是:https://i.imgsafe.org/631ba0d94e.png –
Ricky
哦。那是因爲'inline-block'。它增加了額外的空白。你可以改變你的HTML,以便在一旁,部分申報單,接連像來的權利之一,所以''不「進入」特徵線或空格 –