TypechoJoeTheme

Dcr163的博客

统计

CSS3选择器 :read-write选择器

2017-03-10
/
0 评论
/
669 阅读
/
正在检测是否收录...
03/10

    :read-write”选择器刚好与“:read-only”选择器相反,主要用来指定当元素处于非只读状态时的样式。

例如:设置不是只读控件的文本框边框为2px solid red

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8">
<title>属性选择器</title>
<style>
    form {
      width: 300px;
      padding: 10px;
      border: 1px solid #ccc;
      margin: 50px auto;
    }
    form > div {
      margin-bottom: 10px;
    }
    input[type="text"]{
      border: 1px solid orange;
      padding: 5px;
      background: #fff;
      border-radius: 5px;
    }
    input[type="text"]:-moz-read-only{
      border-color: #ccc;
    }
    input[type="text"]:read-only{
      border-color: #ccc;
    }
    input[type="text"]:-moz-read-write{
      border:2px solid red;
    }
    input[type="text"]:read-write{
      border:2px solid red;
    }
</style>
</head> 
<body>
<form action="#">
  <div>
    <label for="name">姓名:</label>
    <input type="text" name="name" id="name" placeholder="大漠" />
  </div>
  <div>
    <label for="address">地址:</label>
    <input type="text" name="address" id="address" placeholder="中国上海" readonly="readonly" />
  </div>
</form>  
</body>
</html>

效果如下图:

朗读
赞(0)
版权属于:

Dcr163的博客

本文链接:

http://dcr163.cn/137.html(转载时请注明本文出处及文章链接)

评论 (0)

人生倒计时

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. slot mpo terbaru
    2025-02-08
  2. Sherry Stockdill
    2025-01-28
  3. slot demo
    2025-01-13
  4. 陌天
    2025-01-09
  5. Kerrie Bostick
    2024-12-28

标签云