gpt4 book ai didi

html - 如何将 span 的背景颜色设置为外部 div?

转载 作者:行者123 更新时间:2023-11-28 06:28:33 24 4
gpt4 key购买 nike

我希望重置密码的背景颜色为外部 div 的最大宽度。背景颜色必须为标题部分的全宽。如何做?

html:

<div class="forgot-inner">
<!--Forgot-header-->
<div class="forgot-header">
<div class="header">
<span>Reset Password</p>
</div>
</div>
</div>

CSS:

        .forgot-inner {
max-width: 331px;
margin: 39px auto;
padding: 13px 24px;
background: #fff;
text-align: center;
border: 1px solid #aaa;
border-radius: 4px;
box-shadow: 2px 11px 31px 2px rgba(0,0,0,0.2);
}

.forgot-inner .forgot-header .header{
border-bottom:1px solid #aaa;
text-align:left;
background-color:#edefed;
width:100% !important;
font-size: 14px;
font-weight: bold;
}

This is how it looks

最佳答案

 .forgot-inner {
max-width: 331px;
margin: 39px auto;
padding: 13px 24px;
background: #fff;
text-align: center;
border: 1px solid #aaa;
border-radius: 4px;
box-shadow: 2px 11px 31px 2px rgba(0,0,0,0.2);
}

.forgot-inner .forgot-header .header{
border-bottom:1px solid #aaa;
text-align:left;

width:100% !important;
font-size: 14px;
font-weight: bold;
}

.forgot-inner .forgot-header .header span{background-color:#edefed;}
<div class="forgot-inner">
<!--Forgot-header-->
<div class="forgot-header">
<div class="header">
<span>Reset Password</p>
</div>
</div>
</div>

关于html - 如何将 span 的背景颜色设置为外部 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35124559/

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