【发布时间】:2021-11-18 20:19:02
【问题描述】:
我正在开发一个移动网站 (360x640)。
如果您在图片中看到下拉框的默认选项(粉红色背景),并带有提问按钮和选项为选择一个类别...。 ,它的字体非常小,我正在尝试使用 CSS 更改它的字体大小,但它没有改变,保持原样,看起来非常小。请在 CSS 中提供帮助!!!!
我的前端移动视图。
body{
margin-left:20px;
margin-top:20px;
margin-right:20px;
font-size: 20px;
}
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color:rgb(241, 241, 241);
color: orangered;
text-align: center;
}
.experience
{
display: block;
float: right;
}
.see-all{
float: right;
color: orangered;
}
.choose-form
{
background-color:rgb(246, 229, 246);
padding: 10px;
}
.orange
{
background-color:#f78336;
font-size:30px;
color:white;
}
button
{
background-color:#f78336;
font-size:30px;
color:white;
}
option{
font-size: 50px;
}
<form class="choose-form">
<div class="mb-3">
<select class="form-select" id="question">
<option> <span style="font-size:100px;">Select a category : Love,carrer,more ...</span></option>
<option> <span style="font-size:100px;">Love</span></option>
<option> <span style="font-size:100px;">Carrer</span></option>
<option> <span style="font-size:100px;">Marriage</span></option>
</select>
</div>
<nav class="navbar navbar-expand-lg navbar-light">
<!-- edited line -->
<span class="priceShow"> ₹99(including GST)</span>
<span>Ideas what to ask</span>
<div class="profile-icon" style="justify-content-end;">
<button type="submit" class="btn btn-warning orange">Ask a Question </button>
</div>
</nav>
</form>
【问题讨论】:
-
尝试将样式应用到
select元素而不是options。 -
如@JohnP 所说,在选择框上应用字体大小样式。此外,我建议您尝试使用更具响应性的设计或使用 SCSS 功能,当您在各种宽度和高度的移动网站上工作时,它会让您的生活更轻松。
-
您的 HTML 无效。 您不能在
span或option元素中包含 HTML 元素,只允许使用文本和 HTML 实体。 developer.mozilla.org/en-US/docs/Web/HTML/Element/option