【问题标题】:What is the better way of writing input[type=text] or input[type="text"] in css [duplicate]在 css 中编写 input[type=text] 或 input[type="text"] 的更好方法是什么 [重复]
【发布时间】:2017-08-01 15:04:20
【问题描述】:

为我自己的项目编写一些 CSS。在为表单元素编写样式时,我写了一些 CSS 如下:

input[type="text"], input[type="email"] {}

现在我很困惑编写这个 CSS 的最佳方式是什么。这是最好的方式还是我应该写成:

input[type=text], input[type=email] {}

我的意思是在第三个括号中使用双引号或没有任何引号。

【问题讨论】:

    标签: css coding-style standards


    【解决方案1】:

    这是最好的使用方式:

    input[type="text"], input[type="email"] {}
    

    参考:

    查看这里了解更多信息:

    https://www.w3schools.com/css/css_attribute_selectors.asp

    http://www.w3.org/TR/CSS2/selector.html#attribute-selectors

    【讨论】:

    猜你喜欢
    • 2013-06-28
    • 1970-01-01
    • 2011-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-09
    • 2017-07-08
    • 1970-01-01
    相关资源
    最近更新 更多