H1标签边框长度可能吗?
H1 tag border length possible?
我在添加文字的地方为自己制作了全宽图像。
我已经挠头了很长一段时间了。
我正在尝试找到添加上下边框文本的最佳解决方案。
但是,我希望边框的长度为一半或更短,但我就是想不出来。
在 Tag-class 之前,我尝试在文本容器上使用边框 div 但我在将文本居中和正确对齐方面遇到了问题。
现在是这样的:
CSS:
.adcontainer {
position: relative;
width: 100%;
height: auto;
}
.adcontainer img {
width: 100%;
height: auto;
}
.adcontainertext {
position: absolute;
top: 25%;
left: 15%;
z-index: 0;
padding: 0;
padding: 1.2em;
font-size: .5em;
text-align: center;
}
.advertheading
{
font-size: 20px;
border-bottom: 1px solid white;
border-top: 1px solid white;
line-height: 100px;
display:inline-block
}
HTML:
<div style="clear: both;">
<div class="adcontainer"><img src="https://cdn.shopify.com/s/files/1/0786/5107/files/LARGE_BANNER-BELOW.jpg?5938182738858039286" />
<div class="adcontainertext">
<h2 class="advertheading" style="font-weight: normal; color: #ffffff;">Join the club</h2>
</div>
</div>
</div>
此致,
罗宾.
.adcontainer {
position: relative;
width: 100%;
height: auto;
}
.adcontainer img {
width: 100%;
height: auto;
}
.adcontainertext {
position: absolute;
top: 25%;
left: 15%;
z-index: 0;
padding: 0;
padding: 1.2em;
font-size: .5em;
text-align: center;
}
.adcontainertext h2:before {
content: '';
border-top: 1px solid #FFF;
position: absolute;
width: 50%;
left: 25%;
top: 0;
}
.advertheading {
font-size: 20px;
line-height: 100px;
display:inline-block;
position: relative;
}
.adcontainertext h2:after {
content: '';
border-bottom: 1px solid #FFF;
position: absolute;
width: 50%;
left: 25%;
bottom: 0;
}
<div style="clear: both;">
<div class="adcontainer">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/LARGE_BANNER-BELOW.jpg?5938182738858039286" />
<div class="adcontainertext">
<h2 class="advertheading" style="font-weight: normal; color: #ffffff;">Join the club</h2>
</div>
</div>
</div>
我在添加文字的地方为自己制作了全宽图像。 我已经挠头了很长一段时间了。 我正在尝试找到添加上下边框文本的最佳解决方案。
但是,我希望边框的长度为一半或更短,但我就是想不出来。
在 Tag-class 之前,我尝试在文本容器上使用边框 div 但我在将文本居中和正确对齐方面遇到了问题。
现在是这样的:
CSS:
.adcontainer {
position: relative;
width: 100%;
height: auto;
}
.adcontainer img {
width: 100%;
height: auto;
}
.adcontainertext {
position: absolute;
top: 25%;
left: 15%;
z-index: 0;
padding: 0;
padding: 1.2em;
font-size: .5em;
text-align: center;
}
.advertheading
{
font-size: 20px;
border-bottom: 1px solid white;
border-top: 1px solid white;
line-height: 100px;
display:inline-block
}
HTML:
<div style="clear: both;">
<div class="adcontainer"><img src="https://cdn.shopify.com/s/files/1/0786/5107/files/LARGE_BANNER-BELOW.jpg?5938182738858039286" />
<div class="adcontainertext">
<h2 class="advertheading" style="font-weight: normal; color: #ffffff;">Join the club</h2>
</div>
</div>
</div>
此致, 罗宾.
.adcontainer {
position: relative;
width: 100%;
height: auto;
}
.adcontainer img {
width: 100%;
height: auto;
}
.adcontainertext {
position: absolute;
top: 25%;
left: 15%;
z-index: 0;
padding: 0;
padding: 1.2em;
font-size: .5em;
text-align: center;
}
.adcontainertext h2:before {
content: '';
border-top: 1px solid #FFF;
position: absolute;
width: 50%;
left: 25%;
top: 0;
}
.advertheading {
font-size: 20px;
line-height: 100px;
display:inline-block;
position: relative;
}
.adcontainertext h2:after {
content: '';
border-bottom: 1px solid #FFF;
position: absolute;
width: 50%;
left: 25%;
bottom: 0;
}
<div style="clear: both;">
<div class="adcontainer">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/LARGE_BANNER-BELOW.jpg?5938182738858039286" />
<div class="adcontainertext">
<h2 class="advertheading" style="font-weight: normal; color: #ffffff;">Join the club</h2>
</div>
</div>
</div>