gpt4 book ai didi

html - 对齐问题 - block 在彼此下面

转载 作者:太空宇宙 更新时间:2023-11-04 14:52:47 25 4
gpt4 key购买 nike

您知道如何强制将我的 H1 文本放置在蓝色类别按钮下方吗?目前它紧挨着它。非常感谢

http://jsfiddle.net/TDBzN/

enter image description here

<div id="article" class="animated2 fadeInLeftBig">
<div class="article-close"></div>
<div class="category">#Category</div>
<h1>This is the H1</h1>
<p class="intro">Lorem ips um dolor sit amet, consectetur adipiscing elit. Nam sit amet diam nisl. Aliquam quis est eu elit facilisis aliquam. Pellentesque porta nunc diam <a class="various" href="#">Inline</a></p>
</div>

CSS:

#article {
/* opacity controlled via fadeInLeftBig */
position: absolute;
width: 600px;
left: 230px;
top: 0;
height:100%;
background-color: #fff;
opacity:0.9;
padding: 30px 50px 50px 50px;
z-index: 1000;
box-shadow:-2px 0 5px 0 rgba(0, 0, 0, 0.5);
}
#article .intro{
font-family: 'Open Sans', sans-serif;
font-weight:600;
}

#article h1 {
font-size: 33px;
color:#555;
font-style:italic;
}
#article h2 {
color:#555;
margin-bottom:5px;
}
#article p {
font-style: normal;
font-weight: 300;
/* color: #555; */
color: #555;
font-size: 15px;
line-height: 22px;
padding: 10px 0;
margin-top: -10px;
text-align:justify;

}
#article a {
color: #F15034;
text-decoration: none;
font-weight: bold;
}
#article a:hover {
border-bottom: 2px solid #F15034;
}

.category {
float: left;
text-align: center;
font-size: 12px;
color: white;
padding: 8px 18px;
margin: 18px 0 0 0px;
text-decoration: none;
-webkit-transition: background 0.3s ease;
-moz-transition: background 0.3s ease;
-ms-transition: background 0.3s ease;
-o-transition: background 0.3s ease;
transition: background 0.3s ease;
background: rgba(71, 186, 255, 0.8);
}

最佳答案

你应该clear: both;在 h1 标签上。另一种方法是创建一个 clear:both; <div> ,但在这种情况下不需要这样做。

演示:http://jsfiddle.net/TDBzN/6/ ;

h1 
{
clear:both;
}

创建 clear:both; div把它放在 h1 之间元素和 float 元素,在本例中为 .category .

<div style="clear: both;"></div>

这只是在需要清除元素的地方插入有帮助,不适合直接清除元素。

关于html - 对齐问题 - block 在彼此下面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17253032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com