Sublime 快捷键:

文件保存后,输入 html:xt + tab  ,补全html

html:xt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Document</title>
</head>
<body> </body>
</html>

补全class

div.nav + tab = 

<div class="nav"><div>

输入多行<a> 标签

a[#]*3 + tab

<a href="#"></a>
<a href="#"></a>
<a href="#"></a>

案例:

模仿新浪首页

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style type="text/css">
.nav{
height: 40px;
background: #eee;
border-top: 3px solid orange;
border-bottom: 1px solid #aaa;
}
.nav-con{
width: 1000px;
height: 40px;
margin: auto; /*盒子居中对齐*/
/*line-height: 40px;*/
}
a{
font:12px/40px 微软雅黑;/* 文字大小 行高 */
color: #;
display: inline-block;
height: 40px;
text-decoration: none;
}
a:hover{
background: #;
}
</style> </head> <body>
<div class="nav">
<div class="nav-con">
<a href="#">设为首页</a>
<a href="#">手机新浪网</a>
<a href="#">移动客户端</a>
</div>
</div>
</body>
</html>

垂直方向外边距合并 

   垂直方向的两个盒子,如果都设置了垂直方向的外边距,取设置的较大的值。

外边距塌陷

    嵌套的盒子,直接给子盒子设置垂直方向外边距的时候,会发生外边距塌陷。

    解决方法:

    1.给父盒子设置边框;

    2.给父盒子设置 overflow:hidden      bfc 格式化上下文。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style type="text/css">
.father{
width: 500px;
height: 400px;
background: #;
border: 1px solid #;
}
.son{
width: 200px;
height: 200px;
background: #eee;
margin-top: 50px;
}
</style>
</head>
<body>
<div class="father">
<div class="son">
</div>
</div>
</body>
</html>

 

CSS 盒子模型 二的更多相关文章

  1. 深入理解CSS盒子模型

    在CSS中浮动.定位和盒子模型,都是很核心的东西,其中盒子模型是CSS很重要基石之一,感觉还是很有必要把CSS盒子模型相关知识更新一下...... CSS盒子模型<BoxModel>示意图 ...

  2. CSS 盒子模型概述

    一.简介   CSS 盒子模型(元素框)由元素内容(content).内边距(padding).边框(border).外边距(margin)组成.     盒子模型,最里面的部分是实际内容:直接包围内 ...

  3. 几个容易出错的css盒子模型细节

    css是前端必须掌握的技能之一.其中的box模型,如图所示: 大体就是border.margin.padding和content,概念挺好理解.但当盒子模型与其他属性一块使用时产生的现象,或许您还难以 ...

  4. css 盒子模型理解

    盒子模型是html+css中最核心的基础知识,理解了这个重要的概念才能更好的排版,进行页面布局.下面是自己积累和总结的关于css盒子模型的知识^_^,希望对初学者有用. 一.css盒子模型概念 CSS ...

  5. CSS盒子模型之详解

    前言:        盒子模型是css中最核心的基础知识,理解了这个重要的概念才能更好的排版,进行页面布局.一.css盒子模型概念    CSS盒子模型 又称框模型 (Box Model) ,包含了元 ...

  6. [Web 前端] CSS 盒子模型,绝对定位和相对定位

    cp : https://blog.csdn.net/web_yh/article/details/53239372 一.盒子模型: 标准模式和混杂模式(IE).在标准模式下浏览器按照规范呈现页面:在 ...

  7. CSS盒子模型之CSS3可伸缩框属性(Flexible Box)

    CSS盒子模型(下) 一.CSS3可伸缩框(Flexible Box) 可伸缩框属性(Flexible Box)是css3新添加的盒子模型属性,有人称之为弹性盒模型,它的出现打破了我们经常使用的浮动布 ...

  8. 前端之CSS——盒子模型和浮动

    一.CSS盒子模型 HTML文档中的每个元素都被描绘成矩形盒子,这些矩形盒子通过一个模型来描述其占用空间,这个模型称为盒子模型. 盒子模型通过四个边界来描述:margin(外边距),border(边框 ...

  9. CSS盒子模型(框模型)

     一.如何理解盒子模型  盒子模型(框模型)是css部分非常重要的一部分知识,CSS在处理网页的时候,认为每个元素都处在一个不可见的盒子中.盒子模型的构想,把所有的元素都想象成盒子,那么对网页进行布局 ...

随机推荐

  1. 关于android 内存的笔记

    原文 https://developer.android.com/training/articles/memory.html 1.慎重使用Service,最好的办法是使用IntentService,一 ...

  2. symfony 事务提交

    1. 添加数据 新建一个对象,给对象赋值 $em = $this->getDoctrine()->getManager(); //添加事物 $em->getConnection()- ...

  3. sql语句 case when then else end 语句实例

    表中有A B C三列,用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列. ----------------------------------------- ...

  4. SQLServer------远程调用失败

    1.情况 出现 2.解决方法 打开“控制面板” -> “卸载程序” -> 找到 “Microsoft SQL Server 2016) ExpressLocalDB”将其卸载 -> ...

  5. js中forEach,for in,for of的区别

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. git+gitolite+cgit+apache on Ubuntu

    git+gitolite+cgit+apache on Ubuntu Just record, do *NOT* copy-paste. git+gitolite sudo apt-get insta ...

  7. openvpn记住用户名和密码,自动连接

    1, 打开openvpn安装目录 2, 在config目录中, 找到VPN服务器的配置文件, 我的是config.ovpn,将 auth-user-pass (若已经存在)改为 auth-user-p ...

  8. hbase shell 启动报错

    启动hbase之后,发现hbase shell启动报错: version 2.0.0-alpha4, r5c4b985f89c99cc8b0f8515a4097c811a0848835, Tue Oc ...

  9. 【代码审计】CLTPHP_v5.5.3前台XML外部实体注入漏洞分析

    0x01 环境准备 CLTPHP官网:http://www.cltphp.com 网站源码版本:CLTPHP内容管理系统5.5.3版本 程序源码下载:https://gitee.com/chichu/ ...

  10. MVC的路由设置【转】

    转,MVC的路由设置. 后端获取路由里面action的参数,函数需要设置相同的参数名称才行. routes.MapRoute( "Default", "{controll ...