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:
<html>
<head>
<title>div.1</title>
<style type="text/css">
div{width:500px;height:300px;background-color:#eee;
border-bottom-width:5px;
border-bottom-style:dotted;
border-bottom-color:red; border-left-width:10px;
border-left-style:dotted;
border-left-color:green; border-top-width:20px;
border-top-style:dotted;
border-top-color:red; border-right-width:30px;
border-right-style:dotted;
border-right-color:blue;
}
</style>
</head>
<body>
<div>
asdfghjkl
</div>
</body> </html>
例2:
<html>
<head>
<title>div.2</title>
<style type="text/css">
.class1{width:500px;height:300px;line-height:300px;
color:blue;font-size:30px;background-color:red;
border:15px solid green;
text-align:center;
}
.class2{width:400px;height:400px;line-height:400px;
background-color:#aaa;
color:red;font-size:;px;text-align:center;
border:20px dotted blue;
}
</style>
</head>
<body>
<div class="class1">
asdfghjkl
</div>
<div class="class2">
sdnhfajkhfjksdhfu
</div>
</body> </html>
例3:
<html>
<head>
<title>div</title>
<style type="text/css">
div{width:500px;height:300px;background-color:#eee;
border-bottom-width:5px;
border-bottom-style:solid;
border-bottom-color:red; border-left-width:10px;
border-left-style:solid;
border-left-color:green; border-top-width:20px;
border-top-style:solid;
border-top-color:red; border-right-width:30px;
border-right-style:solid;
border-right-color:blue;
}
</style>
</head>
<body>
<div>
asdfghjkl
</div>
</body> </html>
2.div
<div> 元素是块级元素,它是可用于组合其他 HTML 元素的容器。<div> 元素没有特定的含义。除此之外,由于它属于块级元素,浏览器会在其前后显示折行。如果与 CSS 一同使用,<div> 元素可用于对大的内容块设置样式属性。
<div> 元素的另一个常见的用途是文档布局。
HTML+CSS D07 边框、div的更多相关文章
- CSS之边框覆盖
今天想做一个淘宝导航来练练手,遇到了边框覆盖的问题.如下图: li的红色边框盖不住该灰色边框.后来问经验人士告诉我,这种边框覆盖是会出现无法100%保证正常的情况,遂得到如下3中解决方案: 1.以后遇 ...
- 用css控制一个DIV画图标。
在实际开发中,我们会用到一些小图形,图标.大多数情况下都是用图片来实现的,同时对图片进行处理使图片大小尽可能的缩小.但是图片在怎么处理也是按KB来算的.但是要是用CSS画,只要用很少的空间就能完成同样 ...
- CSS border边框属性教程(color style)
CSS 边框即CSS border-border边框样式颜色.边框样式.边框宽度的语法结构与应用案例教程篇 一.CSS 边框基础知识 CSS 边框即CSS border是控制对象的边框边线宽度.颜色. ...
- HTML&CSS基础-边框简写属性
HTML&CSS基础-边框简写属性 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.HTML源代码 <!DOCTYPE html> <html> ...
- CSS渐变色边框,解决border设置渐变后,border-radius无效的问题
需求:用css设置渐变边框通过border-image来实现渐变色边框 <div class="content"></div> .content { wid ...
- CSS学习笔记--Div+Css布局(div+span以及盒模型)
1.DIV与SPAN 1.1简介 1.DIV和SPAN在整个HTML标记中,没有任何意义,他们的存在就是为了应用CSS样式 2.DIV和span的区别在与,span是内联元素,div是块级元素 内联元 ...
- 第50天学习打卡(CSS 圆角边框 盒子阴影 定位)
4.4圆角边框 圆角边框: <!DOCTYPE html> <html lang="en"> <head> <meta char ...
- 通过设置CSS属性让DIV水平居中
通过设置CSS属性让DIV水平居中 ---------------------- <html> <head> <title></title> <m ...
- DIV+CSS常见问题:DIV如何设置一个像素高度?
CSS如何控制DIV实现1像素高度呢?问题看起来很简单,但万恶的IE6会让你很麻烦,不过解决办法很多,本文将介绍最简单的一种:DIV{height:1px;line-height:1px;font-s ...
随机推荐
- 认识<meta>
概要:在查看网页源码的时候,经常发现有<meta>标签存在,于是查了一下它的作用,发现有很多功能.下面就简单的阐述一些常见的功能. 一[什么是<meta>标签] meta,即m ...
- wamp,phpserver,xampp环境冲突
这几天在使用laravel5.2时 执行:php artisan migrate [PDOException] could not find driver 分析可能是以下情况造成 1 php.ini配 ...
- Bullet_Point_Py
1. if __name__ == "__main__" Term: 模块最高级的代码:模块中没有缩进的代码 Principal 1: 第一次导入模块会执行模块最高级的代码.不管你 ...
- poj_3261_Milk Patterns(后缀数组)
题目链接:poj_3261_Milk Patterns 题意: 给你一串数,让你找重复出现不少于k次的子串的最长长度,重复出现可重叠 题解: 老套路,还是二分答案,然后用height数组来check答 ...
- HDU 1069 I Think I Need a Houseboat(模拟)
题目链接 Problem Description Fred Mapper is considering purchasing some land in Louisiana to build his h ...
- DOS/VBS - 用 bat 批处理 实现自动telnet
一.VBS法 1. 建立一个tel.vbs脚本 '建立Shell对象 set sh=WScript.CreateObject("WScript.Shell") WScript.Sl ...
- TortoiseGit - pull request
有一个仓库,叫Repo A.你如果要往里贡献代码,首先要Fork这个Repo,于是在你的Github账号下有了一个Repo A2,.然后你在这个A2下工作,Commit,push等.然后你希望原始仓库 ...
- digitalocean教程:你应该知道的10件事
DigitalOcean VPS性价比高,全球拥有多处机房,无须备案,非常适合守规矩的中国用户使用.digitalocean优惠码.digitalocean速度.digitalocean评测是网友关心 ...
- SCALA STEP BY STEP
http://www.artima.com/scalazine/articles/steps.html http://hongjiang.info/scala/
- windows xp sp3 下载地址
windows xp service pack 3/ windows xp sp3 简体中文版下载地址: http://download.windowsupdate.com/msdownload/ ...