HTML+CSS D07 边框、div

1.边框(border)

  常用表达

  border-width  px

thin定义细的边框。
medium默认。定义中等的边框。
thick定义粗的边框。
length允许您自定义边框的宽度。
inherit规定应该从父元素继承边框宽度。

  border-style  dotted定义点状边框。在大多数浏览器中呈现为实线。     solid定义实线。  double定义双线。双线的宽度等于 border-width 的值。  groove定义 3D 凹槽边框。其效果取决于 border-color 的值。

  border-color  

color_name规定颜色值为颜色名称的边框颜色(比如 red)。
hex_number规定颜色值为十六进制值的边框颜色(比如 #ff0000)。
rgb_number规定颜色值为 rgb 代码的边框颜色(比如 rgb(255,0,0))。
transparent默认值。边框颜色为透明。
inherit规定应该从父元素继承边框颜色。

 

 

border在一个声明中设置所有的边框属性。1
border-bottom在一个声明中设置所有的下边框属性。1
border-bottom-color设置下边框的颜色。2
border-bottom-style设置下边框的样式。2
border-bottom-width设置下边框的宽度。1
border-color设置四条边框的颜色。1
border-left在一个声明中设置所有的左边框属性。1
border-left-color设置左边框的颜色。2
border-left-style设置左边框的样式。2
border-left-width设置左边框的宽度。1
border-right在一个声明中设置所有的右边框属性。1
border-right-color设置右边框的颜色。2
border-right-style设置右边框的样式。2
border-right-width设置右边框的宽度。1
border-style设置四条边框的样式。1
border-top在一个声明中设置所有的上边框属性。1
border-top-color设置上边框的颜色。2
border-top-style设置上边框的样式。2
border-top-width设置上边框的宽度。1
border-width设置四条边框的宽度。1

  例1:

 1 <html>
 2     <head>
 3         <title>div.1</title>
 4         <style type="text/css">
 5             div{width:500px;height:300px;background-color:#eee;
 6             border-bottom-width:5px;
 7             border-bottom-style:dotted;
 8             border-bottom-color:red;
 9             
10             border-left-width:10px;
11             border-left-style:dotted;
12             border-left-color:green;
13             
14             border-top-width:20px;
15             border-top-style:dotted;
16             border-top-color:red;
17             
18             border-right-width:30px;
19             border-right-style:dotted;
20             border-right-color:blue;
21             }
22         </style>
23     </head>
24     <body>
25         <div>
26             asdfghjkl
27         </div>
28     </body>
29 
30 </html>

  例2:

 1 <html>
 2     <head>
 3         <title>div.2</title>
 4         <style type="text/css">
 5             .class1{width:500px;height:300px;line-height:300px;
 6                     color:blue;font-size:30px;background-color:red;
 7                     border:15px solid green;
 8                     text-align:center;
 9             }
10             .class2{width:400px;height:400px;line-height:400px;
11                     background-color:#aaa;
12                     color:red;font-size:40;px;text-align:center;
13                     border:20px dotted blue;
14             }
15         </style>
16     </head>
17     <body>
18         <div class="class1">
19             asdfghjkl
20         </div>
21         <div class="class2">
22             sdnhfajkhfjksdhfu
23         </div>
24     </body>
25 
26 </html>

  例3:

 1 <html>
 2     <head>
 3         <title>div</title>
 4         <style type="text/css">
 5             div{width:500px;height:300px;background-color:#eee;
 6             border-bottom-width:5px;
 7             border-bottom-style:solid;
 8             border-bottom-color:red;
 9             
10             border-left-width:10px;
11             border-left-style:solid;
12             border-left-color:green;
13             
14             border-top-width:20px;
15             border-top-style:solid;
16             border-top-color:red;
17             
18             border-right-width:30px;
19             border-right-style:solid;
20             border-right-color:blue;
21             }
22         </style>
23     </head>
24     <body>
25         <div>
26             asdfghjkl
27         </div>
28     </body>
29 
30 </html>

 

2.div

  <div> 元素是块级元素,它是可用于组合其他 HTML 元素的容器。<div> 元素没有特定的含义。除此之外,由于它属于块级元素,浏览器会在其前后显示折行。如果与 CSS 一同使用,<div> 元素可用于对大的内容块设置样式属性。

  <div> 元素的另一个常见的用途是文档布局。

  

转载于:https://www.cnblogs.com/kylyww/p/5249430.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值