11.18学习日志
11.18学习日志
css
1、CSS的三种引入方式
1、外部样式表 <link rel="stylesheet" href="css/index.css"/> 2、内部样式表 <!--这是内部样式表,CSS样式在style标签中定义--> <style type="text/css"> p{color:Red;} </style> 3、内联样式表 <p style="color:Red; ">绿叶学习网</p>
2、选择器
1、元素选择器 div{width:100px;height:100px;} 2、id选择器 <div id=”box”>id选择器</div> #box{width:100px;height:100px;} 3、class选择器 <p class=”lv”>绿叶学习网</p> <span class=”lv”>绿叶学习网</span> .lv{color:red;} 4、子元素选择器 #father1 div{color:blue;} #father2 #p1{color:red;} 5、相邻选择器 相邻选择器,就是选中该元素的下一个兄弟元素,在这里注意一点,相邻选择器的操作对象是该元素的同级元素。 <div id="lv"> <p>绿叶学习网</p> </div> <div>绿叶学习网</div> <!--选中这个div--> <div>绿叶学习网</div> #lv+div{color:red;} 6、群组选择器 h3,div,p,span{color:red;}
3、文字样式
1、字体类型font-family p{font-family:微软雅黑,宋体,Times New Roman;}
2、字体大小font-size font-size:关键字/像素值;
3、字体颜色color color:颜色值; 4、字体粗细font-weight font-weight:关键值/粗细值;
5、字体斜体样式font-style font-style:取值;
6、CSS注释 语法:/*注释的内容*/






浙公网安备 33010602011771号