gpt4 book ai didi

html - h1 元素需要 padding-top

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

我需要为元素“h1 订阅时事通讯/h1”添加顶部填充,虽然我已经放置了 20px 的填充它根本不起作用请帮忙,下面是代码,

我需要为元素“h1 订阅时事通讯/h1”添加顶部填充,虽然我已经放置了 20px 的填充,但它根本不起作用请帮忙,下面是代码,提前致谢

<!DOCTYPE html>
<html>
<head>
<metadata name="viewport" content="width=device-width"/>
<metadata charset="utf-8"/>
<metadata name="keywords" content="vasu">
<style>
html{
height:100%;
width:100%;
margin:0px;
padding:0px;
}
body{
background-color:red;
width: 100%;
height: 100%;
margin:0px;

}
header {

color: white;
height: 10%;
width: 100%;
background-color:blue;
margin:0;
padding:0;
border-bottom:3px solid yellow;

}
header h1{
float : left;
padding-top : 10px;
margin:0;
text-align: center;

}


header ul{
color:white;
float : right;
padding : 0;
margin:0;
list-style-type: none;


}

li{
float:left;
padding-top:20px;
padding-right: 20px;
text-align:center;
font-size:20px
}

li a {

color: white;
text-decoration:none;
}

.orng{
color: orange;
}

#showcase{
text-align: center;
color: black;
height:40%;
background: url('business-women-working_4460x4460.jpg') -200px;
margin:0px;
border:0px;
padding-top:10px;
padding-bottom:10px;

}



#newsletter h1{
display:inline;
margin:0px:
padding:20px; ------- its not working

}

#newsletter form{
float:right;
display:inline;
padding : 20px;
}

</style>
</head>
<body>
<header>
<div class="container">
<div id="logo">
<h1><span class="orng">ACME</span> WEB DESIGN</h1>
<nav>
<ul>
<li><a href="">Home</a></li>
<li><a href="">Hostel</a></li>
<li><a href="">Company</a></li>
</ul>
</nav>
</div>
</div>

</header>

<section id="showcase">
<div class="container">
<h1>Affordable Web design</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vitae sagittis diam. Donec efficitur metus non commodo tincidunt. Curabitur ornare consectetur eros ac placerat. </p>
</div>

</section>
<section id="newsletter">
<div class="container">
*[![<h1> Subscribe to the newsletter </h1>][1]][1]*
<form>
<input type="text" name="email"></input>
<button type="submit" name="subscribe">SUBSCRIBE</button>
<form>
</div>
</section>

<footer>
</footer>
</body>

</html>

最佳答案

更改 h1 元素以显示为 inline-block,而不是 inline。具有垂直填充的内联元素的行为与您预期的不同:

 #newsletter h1{
display:inline-block;
padding:20px;
}

关于html - h1 元素需要 padding-top,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53158558/

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