css 前端1

css样式
1、怎么样去写样式?
    <link>
    <style>
    <p style=""> </p>



2、样式如何生效
    最近原则,离标签最近的样式生效
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Document</title>
 
</head>
<!-- <style>
  /* p{color: aqua} */
</style> -->

<body>
  <link rel="stylesheet" href="./Untitled-1.css">
  <p>你好 世界</p>
  <p>你好</p>
  
</body>
</html>
#命名一个css样式Untitled-1.css文件
p{color: blueviolet}

在这里插入图片描述

选择器 :selenium如何去定位元素??面试题目

1 、 id选择器
精准的指向到某一个id的属性,同时只能生效一个id
2、class选择器
每个标签可以同时配置多个class属性,也就意味着可以同时生效多个样式信息

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
<style>
#p1{color: blue}
#p2{color: brown}
.size{font-size: 20px}
</style>
</head>

<body>
    <p id="p1" class="size">p1标签</p>
    <p id="p2">p2标签</p>

</body>
</html>

3、标签选择器
html的标签作为选择器,生效的都是那些没有被修改过的样式;

  div{
    /* height: 1000px; */
    /* width: 200px; */
    /* border: 2px  solid red; */
  }
  p{
    font-size: 1px
  }
  input[type="text"]{
    border: 2px  solid  firebrick;
  }

4、属性选择器
input[type=“text”]{
border: 2px solid firebrick;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
<style>
#p1{color: blue}
#p2{color: brown}
.size{font-size: 20px}
input[type="text"]{border: 2px solid rebeccapurple}
</style>
</head>

<body>
    <p id="p1" class="size">p1标签</p>
    <p id="p2">p2标签</p>
<input type="text" name="请输入" id="1">
</body>
</html>

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值