这可能是某种被遗忘的天真细节,但无论如何。
我的h2
下面有一个段落。该段落目前margin-top
30px
将h2
与div
分开,我希望通过应用百分比使其灵活变通。我将1440px定位为100%,而我的段落是width
的孩子,其div
只是100%(未声明)而margin
依次是其他两个到达正文之前的块级元素。所有这些都有100%的宽度。当我将2.083...%
设置为30px
以替换原始#about {
width: 100%;
height: 100vh;
}
.about_center {
padding-top: 13.9%; /*200px*/
position: relative;
background-color: rgba(239,197,198,1.00);
}
#about .about_center h2 {
font-family: 'Montserrat', sans-serif;
word-spacing: 5px;
font-weight: 700;
text-transform: uppercase;
font-size: 3.8em;
line-height: 120%;
text-align: center;
background-color: rgba(221,165,228,1.00);
}
#first-paragraph {
color: rgba(26, 26, 26, 0.8);
margin: 2.083333333333333% /*30px*/ auto 200px;
-webkit-font-smoothing: antialiased;
background-color: rgb(172,235,191);
line-height: 120%;
}
#timeline p {
font-family: "Lato";
font-size: 2em;
text-align: center;
}
时,空间变得更宽,就会出现问题。知道保证金从容器的宽度计算其值,即100%,我想知道为什么它更宽。
<section id="about">
<div class="about_center">
<h2>Example here...</h2>
<div id="timeline">
<p id="first-paragraph">Alright, dude...</p>
<div id="aaaaa">
<h3>Music</h3>
<p>ExampleExampleExampleExampleExampleExampleExampleExample</p>
</div>
<div id="bbbbb">
<h3>Web</h3>
<p>ExampleExampleExampleExampleExampleExampleExample</p>
</div>
<div id="ccccc">
<h3>Local</h3>
<p>ExampleExampleExampleExampleExampleExampleExample</p>
</div>
</div>
</div>
</section>
private static Random s_Gen = new Random();
...
// Controls couldn't be (semi-)transparent, so alpha must be 255
textBox1.BackColor = Color.FromArgb(255, Color.FromArgb(s_Gen.Next()));