【发布时间】:2019-07-21 03:01:25
【问题描述】:
我有一个电子邮件输入字段,它以内联样式设置为 80% 宽度。我将宽度参数移动到一个宽度为 80% 的类,但现在宽度显示为 100%。
html:
<div class="center_text_grid mktg_text">
<input type="text" class="joinpage_input" autofocus="autofocus" placeholder="Your email address" id="email_field" name="email_field" font-size: 18px;" required></div>
CSS:
.center_text_grid {
display: grid;
grid-column: 4 / 15;
grid-row: 20 / 20;
display: block;
overflow: auto;
padding-left: 0%;
align-items: center;
justify-items: center; }
.mktg_text{
font-family: roboto_thinregular;
font-size: 13pt;
color: rgb(117,163,126);
line-height: 1.5; }
.joinpage_input{
border-radius: 15px;
border-style: ridge;
border-color: rgb(250,250,250);
border-width: 1px;
background-color: black;
height: 45px;
width: 80%;
text-align: center;
font-family: robotoregular;
font-size: 18pt;
font-weight: bold;
color: rgb(150,150,150);
letter-spacing: 2px; }
::placeholder {
color: rgb(150,150,150);
font-family: camphorW01-Thin,calibri,arial;
font-size: 12pt;
opacity: 1;
}
为什么不是宽度:80%;控制何时是按钮上的类,而其他两个类没有宽度参数?为什么它可以用作内联样式而不是类样式?
【问题讨论】: