如何在html中以小边距向标题添加背景
我有这个密码如何在html中以小边距向标题添加背景,html,css,Html,Css,我有这个密码 <h1 class="Welcome" style="background-color: #F0E68C;" style="margin-left: 20px;" style="margin-right: 20px;" style="margin-top: 100%;">Welcome To The National </h1> <h1 class=&q
<h1 class="Welcome" style="background-color: #F0E68C;" style="margin-left: 20px;" style="margin-right: 20px;" style="margin-top: 100%;">Welcome To The National </h1>
<h1 class="Welcome" style="background-color: #F0E68C;" style="margin-left: 20px;" style="margin-right: 20px;" style="margin-top: 100%;">Honor Society Website!</h1>
欢迎来到国家图书馆
荣誉协会网站!
它应该在文本后面添加一个背景,但它看起来像是如何使两个文本具有相同的背景,但不占用整个页面,并且行与行之间没有空格。使用
display:table代码>且没有上下边距,并在第一个h1中添加填充
h1
{
显示:表格;
背景色:#F0E68C;
左边距:20px;
右边距:20px;
边缘底部:0px;
边际上限:0px;
}
欢迎来到国家图书馆
荣誉协会网站代码>