<!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. JPA-一对多关系

    JPA中,一对多关系使用@OneToMany标示 关系维护端: package com.yl.demo1.bean.oneTomany; import javax.persistence.Cascad ...

  2. Linux中的设备文件与设备号

    设备文件与设备号   在Linux下,一切皆文件,设备也不例外,为了管理这些设备,系统为它们各自都编了号,而每个设备号又分为主设备号和次设备号.主设备号用来区分不同类型的设备,而次设备号用来区分同一类 ...

  3. 使用Spring Profile和Mybatis进行多个数据源(H2和Mysql)的切换

    最近在做WebMagic的后台,遇到一个问题:后台用到了数据库,本来理想情况下是用Mysql,但是为了做到开箱即用,也整合了一个嵌入式 数据库H2.这里面就有个问题了,如何用一套代码,提供对Mysql ...

  4. ExpectationMaximum

    2- You may have question marks in your head, especially regarding where the probabilities in the Exp ...

  5. VS2010手动添加外部工具和快捷键

    一.添加外部工具 1.选择工具->外部工具 2.选择添加,然后填相应的程序路径和传给程序的参数. 标题:所创建的工具名字 命令:工具路径 参数:工具命令行参数 初始目录:工具工作目录,有些工具可 ...

  6. 解决adb问题的方法

    The connection to adb is down,and a server error has occured. 在网上找的那个高端方法根本不管用,来,试试我的方法.. 先装个360手机助手 ...

  7. 如何把匿名类型.GetType()返回的对象传进泛型里面[转]

    //怎么取得匿名类型的Type放到 //泛型T当中?? var 匿名 = new { A = 0, B = 1 }; Type t = 匿名.GetType(); //然后下面 var xx = db ...

  8. EDM

    今天,夏令营需要发推广EDM. 之前的edm都是文字版, 今天摸索了一下,简单写了些码, 效果还不错. 演示:http://baike.baidu.com/cms/s/bkcampus/summerc ...

  9. SQL2008-表对表直接复制数据

    1.全部复制,使用简单,但是字段容易出错(字段和顺序必须相同)  INSERT INTO AAAStuffAgitationYield SELECT * FROM StuffAgitationYiel ...

  10. A Tour of Go Methods

    Go does not have classes. However, you can define methods on struct types. The method receiver appea ...