html - 输入中的 CSS 区分样式[type=text]
问题描述
我有几个input[type=text]
字段,我想以不同的方式自定义它们。
我必须知道,我们甚至可以为name
房产应用我们的样式。
不幸的是,它在我的情况下不起作用。
我的代码如下所示:
fig input[type=text]
{
width: 250px;
min-width: 100px;
padding: 12px 20px;
box-sizing: border-box;
outline: none;
border: 1px solid #f7fbff;
background-color: #f7fbff;
display: inline-block;
}
<figure class="fig">
<input type="text" name="riser_cupboard_key_type"
pattern="[A-Za-z].{4,}"
title="The text should include at least 4
letters" placeholder="Enter your answer" required>
</figure>
所有选项都不起作用
.fig input[type=text] > input[name="riser_cupboard_key_type"] {
width: 600px;
}
.fig input[type=text] input[name="riser_cupboard_key_type"] {
width: 600px;
}
.fig input[name="riser_cupboard_key_type"] {
width: 600px;
}
我怎样才能使这个指定的输入与其他输入不同?
解决方案
这应该有效:
.fig input[type=text][name="riser_cupboard_key_type"] {
width: 600px;
}
推荐阅读
- html - 如何从头到尾对齐段落中的跨度或文本
- java - 为什么 Repository 代码块在 init 之后执行。适配器?
- javascript - 在 :class 上转换顺风
- javascript - 错误 Ajax 和 Laravel 500(内部服务器错误)
- python - 当涉及的列根据行而变化时,如何在熊猫中执行算术。对不同长度的列求和
- encoding - 如何防止来自 Neo4j 的 Wikidata 查询中不必要的编码?
- javascript - Bootstrap 弹出框只显示一次。为什么?
- python - 无法安装 pyregion
- python - 为什么 SciPy 的curve_fit 找不到协方差/给我这个高阶高斯函数的感觉参数?
- flutter - 谁能告诉如何实现页内导航