用户登录
用户注册

分享至

如何使用 CSS 设置只读属性的样式?

  • 作者: 亖呉?盀
  • 来源: 51数据库
  • 2022-10-20

问题描述

我目前正在使用 readonly=readonly";禁用字段.我现在正在尝试使用 CSS 设置属性的样式.我试过使用

I'm currently using readonly="readonly" to disable fields. I'm now trying to style the attribute using CSS. I've tried using

input[readonly] {
  /* styling info here */
}

但由于某种原因它无法正常工作.我也试过了

but it is not working for some reason. I've also tried

input[readonly='readonly'] {
  /* styling info here */
}

这也不行.

如何使用 CSS 设置 readonly 属性的样式?

How can I style the readonly attribute with CSS?

推荐答案

input[readonly]
{
    background-color:blue;
}

https://curtistimson.co.uk/post/css/style-readonly-attribute-css/

软件
前端设计
程序设计
Java相关