2018年12月6日

css杂记

摘要: 文本缩进:text-indext:2em;(缩进两个字)。 单行文本垂直居中:line-height:20px;(当行文本行高20px,当line-height等于容器的高时,当行文本在容器中垂直居中)。 文本左对齐:text-align:left; px(像素单位)和em都是相对单位,em=1*f 阅读全文

posted @ 2018-12-06 15:01 刚出生的小猿 阅读(159) 评论(0) 推荐(0)

css复杂选择器

摘要: 父子选择器(派生选择器) html: <div> <span>123</span> </div> <span>345</span> css: div span{ background-color:red; } (ps:浏览器在查找父子选择器的时候是从右向左开始查找) 直接子元素选择器 html: < 阅读全文

posted @ 2018-12-06 11:07 刚出生的小猿 阅读(272) 评论(0) 推荐(0)

几种基础的css选择器,以及他们之间的权重(优先级)

摘要: id选择器(1对1的关系,一个元素只能对应一个ID,同样的一个ID也只能对应一个元素) html: <div id="only"></div> css: #only{ width:100px; height:100px; background-color:red; } class选择器(多对多的关系 阅读全文

posted @ 2018-12-06 09:47 刚出生的小猿 阅读(1263) 评论(0) 推荐(0)

html引入css的几种方式

摘要: 行间样式 例如:<div style=" width:100px; height:100px; background-color:red; "></div> 页面级样式 <html><head> <meta charset="utf-8"> <style type="text/css"> div{ 阅读全文

posted @ 2018-12-06 09:13 刚出生的小猿 阅读(252) 评论(0) 推荐(0)

导航