首页 技术 正文
技术 2022年11月9日
0 收藏 766 点赞 3,912 浏览 1181 个字

一:CSS 概述

  • CSS 指层叠样式表 (Cascading Style Sheets)
  • 样式定义如何显示 HTML 元素
  • 样式通常存储在样式表中
  • 把样式添加到 HTML 4.0 中,是为了解决内容与表现分离的问题
  • 外部样式表可以极大提高工作效率
  • 外部样式表通常存储在 CSS 文件中
  • 多个样式定义可层叠为一

二:存在方式

  存在方式有三种:元素内联、页面嵌入和外部引入,比较三种方式的优缺点。

  语法:style = ‘key1:value1;key2:value2;’

  • 在标签中使用 style=’xx:xxx;’
  • 在页面中嵌入 < style type=”text/css”> </style > 块
  • 引入外部css文件

三:选择器

  1)标签选择器

    div{ } 
    <div > </div>

  2)class选择器

    .bd{ } 
    <div class=’bd’> </div>

  3)id选择器

    #idselect{ } 
    <div id=’idselect’ > </div>

  4)关联选择器

    #idselect p{ } 
    <div id=’idselect’ > <p> </p> </div>

  5) 组合选择器

    input,div,p{ }

  6)属性选择器

    input[type=’text’]{ width:100px; height:200px; }

    PS:
     优先级,标签上style优先,编写顺序,就近原则

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#i1,#i2,#i3{
background-color: red;
height: 48px;
}
/*.c1{*/
/*background-color: red;*/
/*height: 48px;*/
/*}*/ div{
background-color: blue;
height: 48px;
}
span div{
background-color: yellow;
height: 48px;
}
.c1 div{
background-color: yellow;
height: 48px;
}
input[n="alex"]{
background-color: yellow;
height: 48px;
}
</style>
</head>
<body>
<div style="background-color: #2459a2;height:48px">1</div>
<span>
<div id="i1">2</div>
</span>
<div class="c1">3</div>
<div id="i1">3</div> <input type="text" n="alex">
<input type="password">
</body>
</html>
上一篇: Vue起步
下一篇: Nginx - 压缩模块
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,491
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,492
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,293