WEB笔记-3、盒子模型+定位+显示
.png)
一、 没有width的元素始终会将宽度扩展填满其父元素为止。添加水平边框、内外边距,会导致内容宽度减少,减少量等于边框+边距
.png)
二、 设定了宽度的盒子添加边框、边距,会导致盒子扩展得更宽,实际上盒子的width属性只是设置了盒子内容区的宽度,而非盒子要占据的水平宽度
.png)
.png)
- 为父元素应用 overflow:hidden
- 浮动父元素
- 在父元素的末尾添加非浮动元素,可以直接在标记中加,亦可以通过给父元素加clearfix类来加(需要一个clearfix的样式规则)
.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title> <style type="text/css">
*{ margin:0; padding:0;}
div{background:#ccc;}
.absolute-test{position:absolute; top:100px; left:100px;}
.absolute-test h1{background:#333; color:orange;}
body{margin-top: 30px !important;}
</style>
</head>
<body>
<div>this is static position</div>
<div class="absolute-test"><h1>I'm absulote</h1></div>
<div>this is static position</div>
</body>
</html>
>>bottom=0就是页脚了 ^。^
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
*{ margin:0; padding:0;}
div{background:#ccc;}
.absolute-test{position:fixed; top:0px; left:100px;}
.absolute-test h1{background:#333; color:orange;}
body{margin-top: 30px !important;}
</style>
</head>
<body>
<div>this is static position</div>
<div class="absolute-test"><h1>I'm absulote</h1></div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
<div>this is static position</div>
</body>
</html>
>>对了,这个东西拿来做导航很不错^。^...

WEB笔记-3、盒子模型+定位+显示的更多相关文章
- Python web前端 04 盒子模型
Python web前端 04 盒子模型 盒子模型是由内容(content).内边距(padding).外边距(margin).边框(border)组成的 一.边框 border #border 边框 ...
- CSS之选择符、链接、盒子模型、显示隐藏元素
<html> <head> <meta charset="utf-8"> <title>选择符.链接.盒子模型.显示隐藏元素< ...
- web前端学习笔记(CSS盒子的定位)
相对定位 使用相对定位的盒子的位置常以标准流的排版方式为基础,然后使盒子相对于它在原本的标准位置偏移指定的距离.相对定位的盒子仍在标准流中,它后面的盒子仍以标准流方式对待它. 使用relat ...
- WEB入门.六 盒子模型
学习内容 CSS盒子模型 盒子之间的关系 页面元素定位 能力目标 理解盒子模型 理解内容与表现分离的优点 理解并掌握盒子之间的关系 理解并掌握绝对定位与相对定位的用法 本章简介 上一章节中已经讲解了页 ...
- [Web 前端] CSS 盒子模型,绝对定位和相对定位
cp : https://blog.csdn.net/web_yh/article/details/53239372 一.盒子模型: 标准模式和混杂模式(IE).在标准模式下浏览器按照规范呈现页面:在 ...
- HTML&CSS精选笔记_盒子模型
盒子模型 认识盒子模型 所谓盒子模型就是把HTML页面中的元素看作是一个矩形的盒子,也就是一个盛装内容的容器.每个矩形都由元素的内容.内边距(padding).边框(border)和外边距(margi ...
- css标签样式 边框 盒子模型 定位 溢出 z-index 透明度
目录 一.CSS设置标签样式 1. 给标签设置长和宽 2.字体的颜色(3种表示方法) 3.文本样式 4. 语义 5. 背景样式 6. 边框 6.1 边框变圆 7.display 标签转换 二.盒子模型 ...
- CSS学习笔记:盒子模型
盒子模型(CSS basic box model):When laying out a document, the browser's rendering engine represents each ...
- CSS 小结笔记之盒子模型
网页标签可以看成是一个个盒子,页面设计就像垒积木一样,在网页中将盒子摆好显示出来.在浏览器中可以很清楚的去看到一个标签的盒子,具体方法如下: 打开浏览器的开发人员工具,在Elements中选中一个标签 ...
随机推荐
- python爬虫19 | 遇到需要的登录的网站怎么办?用这3招轻松搞定!
你好 由于你是游客 无法查看本文 请你登录再进 谢谢合作 当你在爬某些网站的时候 需要你登录才可以获取数据 咋整? 莫慌 小帅b把这几招传授给你 让你以后从容应对 那么 接下来就是 学习 python ...
- Thinkphp5跨域问题
关于代码分离可能会遇到json传输接收不到的问题(可能00) 起初我百度到解决此问题可以用jsonp来发送并接受,可是这只是一时之计 以后也会不方便所以我发现了一下方法 在app顶层创建文件commo ...
- fastclick:处理移动端click事件300毫秒延迟
fastclick:处理移动端click事件300毫秒延迟 1.兼容性 iOS 3及更高版本的移动Safari iOS 5及更高版本的Chrome Android上的Chrome(ICS) Opera ...
- (43). Spring Boot动态数据源(多数据源自动切换)【从零开始学Spring Boot】
在上一篇我们介绍了多数据源,但是我们会发现在实际中我们很少直接获取数据源对象进行操作,我们常用的是jdbcTemplate或者是jpa进行操作数据库.那么这一节我们将要介绍怎么进行多数据源动态切换.添 ...
- 运维系列之二 Linux文件种类和扩展名
一.文件种类 1.普通文件 用ls查看文件属性时,显示的是[-] 2.目录文件(directory) 文件属性第一个为[d] 3.连接文件(link) 类似于win下的快捷方式,文件第一个属性为[l] ...
- 华为/H3C Syslog配置
H3C交换机的设置举例1. 组网需求将系统的日志信息发送到 linux 日志主机:日志主机的IP 地址为1.2.0.1/16:信息级别高于等于 informational 的日志信息将会发送到日志主机 ...
- html实现 省——市——区三级联动
html实现 省——市——区三级联动 html中实现三级联动是一个不错的demo,博主在这里跟大家分享一下实现的过程,以及自己在过程中出现的一些问题,仅供参考. 首先我们将全国的省市区数据导入进来, ...
- backup script
#!/bin/bash ##################################################### # export the whole database use ex ...
- sysman 账号 oracle em console的一些问题
前几天用下面的命令修改了 sysman的密码. [oracle@racnode1 ~]$ emctl setpasswd dbconsole Oracle Enterprise Manager 11g ...
- Java开发中的几种对象的说明(PO,VO,DTO,BO,POJO,DAO,SAO等)
一.PO :(persistant object ),持久对象 可以看成是与数据库中的表相映射的java对象.使用Hibernate来生成PO是不错的选择. 二.VO :(value object) ...