html - h1 标签的高度有问题,似乎是从另一个对象继承的

标签 html css

我真的无法解释我的问题所以这里是一个例子:

如果您检查第一个 <h1>标记你会注意到它的高度是从另一个对象继承的。我想解决这个问题......

.wrapper {
	width: 1300px;
	margin: 0 auto;
	text-align: center;
}

.feed {
	width: 950px;
	height: 800px;
	border-right: 2px solid #f0f0f0;
}

.videoContainer {
	background-color: #fafafa;
	width: 950px;
	height: 450px;
	text-align: center;
	display: inline-block;
	float: left;
}

#videoTitle {
    margin: 0;
	color: #333;
	font-size: 22px;
	font-family: Arial, sans-serif;
}
<div class="wrapper">
    <div class="content">
                <div class="feed">
                    <div class="videoContainer"><iframe width="800" height="450" src="https://www.youtube.com/embed/8GpDXV9BfLU" frameborder="0" allowfullscreen></iframe></div>
                    <h1 id="videoTitle">Something here</h1>
                    <h1 id="videoTitle">Something lorem ipsum.. To make this text a bit longer than the previous one.</h1>
                    <h1 id="videoTitle">and something short.</h1>
                </div>
    </div>
</div>

有什么想法吗?谢谢。

最佳答案

添加clear: left;<h1> .目前它的高度为.videoContainer因为 float: left;在上面。

关于html - h1 标签的高度有问题,似乎是从另一个对象继承的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30429688/

相关文章:

html - 遮住 window 的小缝隙

html - 动画结束后网格单元不会从布局中消失

javascript - 在缩放的 div 中设置 div 鼠标坐标

html - 我的 &lt;input type ="text"/> 元素高度不同

html - 固定子元素在 Firefox 浏览器中闪烁

css - 如何让轮播中的图像居中?

php - 在 PHP 中将长十六进制代码转换为短十六进制代码

javascript - 红色文本框边框颜色

javascript - ARIA 地标在文本区域/输入中不起作用

html - 用 border-radius 隐藏的溢出仍然显示小边框