<!DOCTYPE HTML>
<html>
<head>
<title>div浮动</title>
<style type="text/css">
body{ margin: 0px 1px 2px 3px;
} #father{ background-color: yellow;
width: 100%;
height: 100px;
border: dashed green;
} #son1{
float: left;
} #son2{
float: left;
} #son3{
float: left;
} #clear{
clear: both;
}
</style> </head>
<body>
<!--是div在同一列上,如果清楚浮动效果 同层div也会浮动-->
<div id="father">
<div id="son1">aaaaaa</div>
<div id="son2">bbbbbb</div>
<div id="son3">cccccc</div>
<div id="clear"></div>
<div>dddddddddddd</div>
</div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<title>div浮动</title>
<style type="text/css">
body{ margin: 0px 1px 2px 3px;
} #father{ background-color: yellow;
width: 100%;
height: 100px;
border: dashed green;
position:relative;
} #son1{
position: absolute;
margin-left: 60%;
} #son2{ } </style> </head>
<body>
<!--相对定位,元素没有脱离文本流-->
<!--绝对定位,是相对于浏览器-->
<!--如果相对于父节点的绝对定位,父节点要设置相对定位,脱离文本流-->
<!--result bbbbbb aaaaaaaaaa-->
<div id="father">
<div id="son1">aaaaaa</div>
<div id="son2">bbbbbb</div> </div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<title>div常用样式</title>
<style type="text/css"> #father{ background-color: yellow;
width: 100%;
height: 100px;
border:1px dashed green;
} #son1,#son2,#son3{
background-color: green;
width: 100px;
margin-left: 5px;
margin-top: 5px;
display: inline; /*3个div显示在同一行*/
} #son3{
display: none; /*隐藏第三个div*/
} #son2:hover,#son1:hover{
background-color: blue;
cursor: hand;
} </style> </head>
<body> <div id="father">
<div id="son1">aaaaaa</div>
<div id="son2">bbbbbb</div>
<div id="son3">bbbbbb</div>
</div>
</body>
</html>

CSS_样式sample的更多相关文章

  1. css_样式样式器的分类

    详情:http://www.w3school.com.cn/h.asp 1.标签样式器:此样式器仅对html页面中div标签有效果 div{ background-color: rosybrown; ...

  2. react native 第三方组件react-native-swiper 轮播组件

    github地址:https://github.com/leecade/react-native-swiper 使用方法:安装:npm i react-native-swiper –save 查看模块 ...

  3. CSS_简介/语法结构/长度单位/应用方式/标签的样式重置/表单样式重置

    一.CSS简介:  w3c(World Wide Web Consortium):万维网联盟,是规定网页标准的一个组织(叫做Web标准) Web标准:是由w3c和其他标准化组织制定的一系列标准的集合, ...

  4. Css_加载样式

    第一种效果: 代码如下: <div class="loading"> <span></span> <span></span&g ...

  5. 浏览器默认样式(user agent stylesheet)+cssreset

    每种浏览器都有一套默认的样式表,即user agent stylesheet,在写网页时,没有指定的样式,按浏览器内置的样式表来渲染.这是合理的,像word中也有一些预留样式,可以让我们的排版更美观整 ...

  6. PHP团队 编码规范 & 代码样式风格规范

    一.基本约定 1.源文件 (1).纯PHP代码源文件只使用 <?php 标签,省略关闭标签 ?> : (2).源文件中PHP代码的编码格式必须是无BOM的UTF-8格式: (3).使用 U ...

  7. Sample Apps by Android Team -- Amazed

    Sample Apps by Android Team 代码下载:http://pan.baidu.com/s/1eSNmdUE , 代码原地址:https://code.google.com/arc ...

  8. bootstrap入门-4.排版及其他固定样式

    本篇包括以下内容:排版.代码.表格.表单. 总结:超无聊,弃更. · 排版样式                                     标题 h1-h6 取消加粗,字体大小也有一定变化 ...

  9. 仿iOS Segmented Control样式"

    同步发表于http://avenwu.net/2015/02/05/styled_radiogroup_segmented_control Fork on github https://github. ...

随机推荐

  1. Java [leetcode 17]Letter Combinations of a Phone Number

    题目描述: Given a digit string, return all possible letter combinations that the number could represent. ...

  2. 【转】 Android中退出程序的提示框

    原文网址:http://blog.csdn.net/jumping_android/article/details/7571309 @Override public boolean onKeyDown ...

  3. jquery页面无刷新切换皮肤并保存

    效果体验:http://runjs.cn/detail/hijgcghe <!DOCTYPE html> <html> <head> <meta http-e ...

  4. (二)学习JavaScript之setInterval和clearInterval方法

    参考:http://www.w3school.com.cn/jsref/met_win_setinterval.asp HTML DOM Window 对象 定义和用法 setInterval() 方 ...

  5. java日历类Calendar简单使用

    import java.util.Calendar; import java.util.TimeZone; public class Test1 { public static void main(S ...

  6. shell获取db信息及上传下载操作

    这个脚本是获取目标机器的db信息和os信息的.os信息很好获取,db的信息包含db名字,db版本以及所有的db instance,db信息的获取稍显复杂,下面是整个脚本代码: 关键字: awk, se ...

  7. uva 11178

    题意:根据A,B,C三点的位置确定D,E,F三个点的位置. 贴模板 #include<cstdio> #include<cmath> #include<cstring&g ...

  8. Windows下ffmpeg的完美编译

    纠结了好几天,终于搞定了,小结一下. 1.下载ffmpeg源码,官网 2.编译环境Msys的安装配置,http://blog.csdn.net/jszj/article/details/4028716 ...

  9. 【转载】IP首部、TCP首部、UDP首部

    [转载自]http://blog.csdn.net/hjffly/article/details/7959889 IP首部 版本:L3协议版本号,IPv4或IPv6 首部长度:单位为4字节 协议:L4 ...

  10. 【转载】free查看内存

    http://blog.csdn.net/hylongsuny/article/details/7742995 free 命令相对于top 提供了更简洁的查看系统内存使用情况:$ free       ...