css3的样式讲解-css学习之旅(3)

来源:互联网 发布:写给大家看的算法 pdf 编辑:程序博客网 时间:2024/06/11 20:24

css背景

属性:background-color;background-image:url(“位置”);background-position:right等,px,百分数;background-repeat:norepeat,repreat,laft,right

代码实例

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Html5样式</title>    <link href="MyCss.css" type="text/css" rel="stylesheet"></head><body>    <p title="t">属性选择器</p>    <p title="te">属性和值得选择器</p></body></html>

css代码

body{    background-image: url("hello.jpg");    background-repeat: no-repeat;    background-position: right top;}

!!效果图

background-attachment: fixed表示随着字幕的滑动,图片不会滑动

!!!!css3背景区域

background-size:规定背景区域的尺寸

background-origin:规定背景区域的定位区域

background-clip:规定背景区域的绘制区域

!!!!代码

body{    background-image: url("hell.jpg");    background-repeat: no-repeat;    background-size: 500px 500px;}
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Html5样式</title>    <link href="MyCss.css" type="text/css" rel="stylesheet"></head><body>    <p title="t">属性选择器</p>    <p title="te">属性和值得选择器</p></body></html>

!!!!效果图

这里写图片描述

0 0
原创粉丝点击