CSS入门 笔记
CSS(Cascading Style Sheets)中文解释层叠样式表CSS的三种引入方式行内式内联样式在相关的标签内使用样式style属性内部样式表使用 style 标签在文档头部定义内部样式表外链式使用 link 标签链接到样式表三种css同时修饰同一标签是存在优先级行内式内部样式外链式p stylecolor: sienna; margin-left: 20px head style typetext/css hr {color: sienna;} p {margin-left: 20px;} body {background-image: url(images/back40.gif);} /style /head head link relstylesheet typetext/css hrefmystyle.css / /headCSS选择器ID选择器#id {}class类选择器 .ckass名{}元素选择器元素{}通配符选择器*{}style typetext/css #box1{/*同一个网页中不能有重复的id名称id名由数字字母下划线$组成不能以数字开头*/ color:red; } .yellow{ background-color:#ff0 ; } div{ font-weight: bold; font-size: 25px; } *{ /*border:1px solid black;*/ } /style body div idbox1 classyellow文字测试/div div idbox2 classyellow文字测试/div /body子代选择器h1 strong {color:red;} h1This is strongvery/strong strongvery/strong important./h1后代选择器h1 em {color:red;} h1This is a emimportant/em heading/h1