[英]Styling buttons with width inside container
Take a look at http://crashjapan.net - in the sidebar, the Subscribe button (submit element) is staying inside its box, nicely centered, but the three buttons under "I want to help!" 看一下http://crashjapan.net-在边栏中,“订阅”按钮(“提交”元素)停留在其框内,居中,但“我想帮助!”下面的三个按钮。 (link elements styled like buttons) are too wide.
(样式类似于按钮的链接元素)太宽。 I have looked through the CSS but I can't figure out what is different and what to do to fix it.
我已经浏览了CSS,但无法弄清楚有什么不同以及如何解决它。 Can someone else spot the problem?
别人可以发现问题吗?
#secondary .widget .button {
color: white;
font-size: 1.2em;
margin: 0 10% 5px 10%;
width: 80%;
text-align: center;
box-sizing: border-box;
}
This is one possible solution. 这是一种可能的解决方案。
Remove this: 删除此:
margin: 0 10% 5px 10%;
from this in your style.css: 在您的style.css中:
#secondary .widget .button {
color: white;
font-size: 1.2em;
margin: 0 10% 5px 10%;
width: 80%;
text-align: center;
}
Edit Your class: 编辑您的课程:
#secondary .widget .button {
clear: both;
color: white;
font-size: 1.2em;
margin: auto;
text-align: center;
width: 78%;
}
Change your button #secondary .widget .button to this: 将您的按钮#secondary .widget .button更改为:
{
color: #FFF;
font-size: 1.2em;
margin: 6px 0% 0px -5px !important;
margin-top: 0px;
margin-right: 0%;
margin-bottom: 0px;
margin-left: 0px;
width: 70%;
}
6px will leave some space between those buttons. 6px将在这些按钮之间保留一些空间。 width 70% will be also play a role for the margin.
宽度70%也将为保证金发挥作用。 You can try to play the width a bit to see how it looks like.
您可以尝试稍微播放一下宽度,以查看其外观。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.