css背景图片的使用和盒子模型

135 阅读1分钟

了解盒子模型:由外到内margin-boerder-padding-contert
boder:
boder-top-width:border边框 顶部的粗细
boder-top-color:border边框 顶部的颜色
boder-top-style:border边框 顶部的风格
style种类:none无边框 solid:实线边框 dashed:虚线边框 dotted:双线边框 hidden:与none一样 通常用来解决表格边距的冲突 bottom下 right右 left左 使用与top类似

背景使用照片: backgroud-image:url(路径) 适用该路径照片 /默认会覆盖所在块(行)元素/
background-repeat:no-reapet;限制出现次数 no-reapeat出现一次不重复 background-position:50% 40%设置图片所在x y轴所在位置 也可用center left类似单词或 px 来决定

1.background-position 2.background-repeat
以上两种都可以单独设置x y 轴位置 如:
background-repeat-x: background-position-y:分别设置了repeat的x轴位置和position的y轴位置