即使使用宽度,我的CSS-Button也不会得到反应
我必须设计一份时事通讯,但是我的按钮没有响应。大概是因为班级的原因吧。如果我在课堂外创建另一个,它会变得更好。该类没有 css 那么为什么它可以更改我的按钮。
HTML-Code:
<!DOCTYPE html\>
Title
<!-- stylesheet für das Sende-Button-icon hinzugefügt-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<form action="https://adra.us6.list-manage.com/subscribe/post?u=e2d5faa9b94a0d751d430e84b&id=28f961ba01" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="mc-field-group input-group">
<ul><li><input type="checkbox" value="Herr" name="MMERGE3" id="mce-MMERGE3-0"><label for="mce-MMERGE3-0">Herr</label></li>
<li><input type="checkbox" value="Frau" name="MMERGE3" id="mce-MMERGE3-1"><label for="mce-MMERGE3-1">Frau</label></li>
<li><input type="checkbox" value="Anders" name="MMERGE3" id="mce-MMERGE3-2"><label for="mce-MMERGE3-2">Keine Angaben</label></li>
</ul>
</div>
<div class="mc-field-group">
<input type="text" value="" name="VNAME" class="required" id="mce-VNAME" placeholder="Vorname" required>
</div>
<div class="mc-field-group">
<input type="text" value="" name="LNAME" class="required" id="mce-LNAME" placeholder="Familienname" required>
</div>
<div class="mc-field-group">
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" placeholder="eMail" required>
</div>
<div id="mce-responses" class="clear foot">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_e2d5faa9b94a0d751d430e84b_28f961ba01" tabindex="-1" value=""></div>
<div class="optionalParent">
<div class="clear foot">
<button name="subscribe" id="mc-embedded-subscribe" class="button"><i class="far fa-paper-plane"></i> Senden</button>
</div>
</div>
</div>
</form>
CSS-Code:
#mc_embed_signup .input-group ul {
font-weight: 400;
line-height: 1.5;
font: 16px Zilla;
display: flex;
justify-content: space-between;
width: 50%;
box-sizing: border-box;
height: 20px;
text-align: left;
}
#mc_embed_signup .mc-field-group input[type="text"], #mc_embed_signup .mc-field-group input[type="email"] {
background: #ffffff;
border-color: #D9D9D6;
border-width: 1px;
border-radius: 3px;
padding: 4px 6px;
min-height: 33px;
max-width: 100%;
-basis: 100%;
font: 13px Zilla;
margin: 10px 0;
}
#mc_embed_signup .optionalParent #mc-embedded-subscribe {
background: #007960;
color: #ffffff;
width: 100%;
padding: 0 24px;
font: 15px Zilla;
border-radius: 3px;
flex-basis: 100%;
cursor: pointer;
vertical-align: middle;
margin-top: 10px;
min-height: 35px;
overflow: hidden;
}
#mc_embed_signup .optionalParent #mc-embedded-subscribe:hover {
background-color: #007960;`
}
我期望按钮达到 100%,其中输入结尾。
如果我删除除按钮之外的所有 css 代码: 在此处输入图片说明
I have to design a newsletter, however my button doesn't get responsive. It is probably because of the class. If I create another outside the class it gets better. The class has no css so why can it change my button.
HTML-Code:
<!DOCTYPE html\>
Title
<!-- stylesheet für das Sende-Button-icon hinzugefügt-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<form action="https://adra.us6.list-manage.com/subscribe/post?u=e2d5faa9b94a0d751d430e84b&id=28f961ba01" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="mc-field-group input-group">
<ul><li><input type="checkbox" value="Herr" name="MMERGE3" id="mce-MMERGE3-0"><label for="mce-MMERGE3-0">Herr</label></li>
<li><input type="checkbox" value="Frau" name="MMERGE3" id="mce-MMERGE3-1"><label for="mce-MMERGE3-1">Frau</label></li>
<li><input type="checkbox" value="Anders" name="MMERGE3" id="mce-MMERGE3-2"><label for="mce-MMERGE3-2">Keine Angaben</label></li>
</ul>
</div>
<div class="mc-field-group">
<input type="text" value="" name="VNAME" class="required" id="mce-VNAME" placeholder="Vorname" required>
</div>
<div class="mc-field-group">
<input type="text" value="" name="LNAME" class="required" id="mce-LNAME" placeholder="Familienname" required>
</div>
<div class="mc-field-group">
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" placeholder="eMail" required>
</div>
<div id="mce-responses" class="clear foot">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_e2d5faa9b94a0d751d430e84b_28f961ba01" tabindex="-1" value=""></div>
<div class="optionalParent">
<div class="clear foot">
<button name="subscribe" id="mc-embedded-subscribe" class="button"><i class="far fa-paper-plane"></i> Senden</button>
</div>
</div>
</div>
</form>
CSS-Code:
#mc_embed_signup .input-group ul {
font-weight: 400;
line-height: 1.5;
font: 16px Zilla;
display: flex;
justify-content: space-between;
width: 50%;
box-sizing: border-box;
height: 20px;
text-align: left;
}
#mc_embed_signup .mc-field-group input[type="text"], #mc_embed_signup .mc-field-group input[type="email"] {
background: #ffffff;
border-color: #D9D9D6;
border-width: 1px;
border-radius: 3px;
padding: 4px 6px;
min-height: 33px;
max-width: 100%;
-basis: 100%;
font: 13px Zilla;
margin: 10px 0;
}
#mc_embed_signup .optionalParent #mc-embedded-subscribe {
background: #007960;
color: #ffffff;
width: 100%;
padding: 0 24px;
font: 15px Zilla;
border-radius: 3px;
flex-basis: 100%;
cursor: pointer;
vertical-align: middle;
margin-top: 10px;
min-height: 35px;
overflow: hidden;
}
#mc_embed_signup .optionalParent #mc-embedded-subscribe:hover {
background-color: #007960;`
}
I expectet the button to get up to 100%, where the inputs end.
If I remove all the css-code excluding the button:
enter image description here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我注意到您在CSS中写了一个错误的ID名称。您写了
#mc_embed_signup
,但根据您的HTML,正确的是#MC_EMBED_SIGNUP_SCROLL
。为了使按钮宽度完整,只需在CSS中的第二组类中添加
width:100%
即可。您只需用以下一个即可替换CSS即可快速解决方案。
I noticed you wrote an incorrect ID name in the CSS. You wrote
#mc_embed_signup
but correct is#mc_embed_signup_scroll
as per your HTML.For making button width full just need to add
width:100%
in the second group of classes in your CSS.You can simply replace your CSS with the below one for a quick solution.