input输入框改变颜色 以及input输入内容更改颜色

2023-4-21    前端达人

效果图
在这里插入图片描述
1- 改变input输入框颜色
border: 1px solid pink;
2-改变input输入内容颜色
color: pink;
全部代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css新增属性值</title>
    <style>
        /* 必须是input元素;但是同时也具备input元素有value这个值    用中括号[]*/
        /* input[value]{
            color:red
        } */

        *{
            padding: 0;
            margin: 0;
        }
        input[type=password]{
            color: pink;
            border: 1px solid pink;
            outline: none;

        }
    </style>
</head>
<body>
    <!--1.利用属性选择器就可以不用借助于类或者id选择器  -->

    <!-- <input type="text" value="请输入你喜欢的人">
    <input type="text"> -->
      <!-- 2.属性选择器还可以选择属性=值的某些元素 -->
      <input type="text">
      <input type="password">

</body>
</html>``` 
            
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

分享本文至:

日历

链接

blogger

蓝蓝 http://www.lanlanwork.com

存档