CSS布局实战
1、 ul li中上图下字,图片、文字居中。
<ul>
<li>
<img src="dash.png" style="display:block;height:20px;width:20px;margin: 0 auto">
<span style="float:left;text-align:center;">Dashboard</span>
</li>
</ul>

文字换行:display:block
图片居中:margin: 0 auto
文字居中:float:left;text-align:center
2、页面遮罩的实现
z-index属性决定了元素的显示层级,z-index越大,显示层级越靠上。
opacity表示透明度。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>html 最简遮罩层</title>
<script type="text/javascript">
function showDiv(){
document.getElementById('popDiv').style.display='block';
document.getElementById('bg').style.display='block';
}
function closeDiv(){
document.getElementById('popDiv').style.display='none';
document.getElementById('bg').style.display='none';
}
</script>
</head>
<body>
<div id="popDiv" style="z-index:99;display:none;position:absolute;margin-top: 20%;margin-left: 40%;background-color: #FFF;">
分析中...<br/>
<a href="javascript:closeDiv()">关闭遮罩层</a>
</div>
<div id="bg" style="display:block;background-color: #ccc;width: 100%;position:absolute;height: 100%;opacity: 0.5;z-index: 1;"></div>
<div style="padding-top: 10%;padding-left:40%;z-index:1;">
<input type="Submit" name="" value="打开遮罩层" onclick="javascript:showDiv()" />
</div>
</body>
</html>
3、样式优先级!important
.menu_accordion .nav-first-level li div
{
background-color:#FFFFFF!important;
}
4、阻止div换行
(1)使用tbale封装div为列
(2)使用样式float:left;
(3)使用样式display:inline;
<html>
<head>
<style type="text/css">
.myrow{
border:#c3c3c3 1px solid;
height:30px;
margin:5px;
} .myfloat{
float:left;
margin:2px;
} .mydisplay{
display:inline;
margin:2px;
} .myline{
border-style:solid;
border-color:#c3c3c3;
border-width:0px 0px 0px 1px;
height:20px;
} </style>
</head>
<body>
<div id="row1" class="myrow">
<table>
<tbody>
<tr>
<td>
<div>
根因1
</div>
</td>
<td>
<div>
</div>
</td>
<td>
<div>
故障场景1
</div>
</td>
<td>
<div>
</div>
</td>
</tr>
</tbody>
</table>
</div> <div id="row2" class="myrow" style="height:30px">
<div class="myfloat">
根因2
</div>
<div class="myfloat myline" >
</div>
<div class="myfloat">
故障场景2
</div>
<div class="myfloat">
</div>
</div> <div id="row3" class="myrow">
<div class="mydisplay">
根因3
</div>
<div class="mydisplay">
</div>
<div class="mydisplay">
故障场景3
</div>
<div class="mydisplay">
</div>
</div> </body>
</html>
<html>
<head>
<style type="text/css">
.myrow{
border:#c3c3c3 1px solid;
height:26px;
margin:5px;
width:90%;
} div div{
float:left;
height:26px;
margin:2px 5px 2px 5px;
} .myline{
border-style:solid;
border-color:#c3c3c3;
border-width:0px 0px 0px 1px;
height:20px;
} .myid{
width:10%;
} .mycause{
width:70%;
} .myimg{
background-image: url(myimg.png);
background-color: #FFFFFF;
width:23px;
height:23px;
margin:3px 0px 3px 5px;
} body{
font-size:15px;
color:#666;
font-family:"Helvetica","微软雅黑";
} </style>
</head>
<body> <div class="myrow">
<div class="myimg">
</div>
<div class="myid" >
根因1
</div>
<div class="myline" >
</div>
<div class="mycause" >
故障场景1
</div>
<input type="checkbox" style="margin:7px">
<div>
</div>
</div> <div class="myrow">
<div class="myimg">
</div>
<div class="myid" >
根因2
</div>
<div class="myline" >
</div>
<div class="mycause" >
故障场景2
</div>
<input type="checkbox" style="margin:7px">
<div>
</div>
</div>
</body>
</html>
CSS布局实战的更多相关文章
- CSS学习笔记--Div+Css布局实战(入门)
基本页面布局 本教程带着大家做一个简单的页面布局 最重效果如下: 1.第一部,先创建上下左右4个DIV <!DOCTYPE html> <html> <head lang ...
- CSS+DIV网页样式布局实战从入门到精通 中文pdf扫描版
CSS+DIV网页样式布局实战从入门到精通通过精选案例引导读者深入学习,系统地介绍了利用CSS和DIV进行网页样式布局的相关知识和操作方法. 全书共21章.第1-5章主要介绍网页样式布局的基础知识,包 ...
- 第6天:DIV+CSS页面布局实战
今天我从早上9:00写代码一直写到下午18:00,写的我差点抑郁了,还好最后终于写出了一个完整页面,没有做动画效果,就是练习了一下DIV+CSS布局,做的是福务达(www.zzfwd.cn)的主页,真 ...
- 3.实战HTML+CSS布局(实例入门篇)
转自:https://www.cnblogs.com/hmyprograming/archive/2012/03/23/2414373.html 学习这篇入门教程我们假定你已经具有了一定的HTML基础 ...
- [转]基于display:table的CSS布局
当IE8发布时,它将支持很多新的CSS display属性值,包括与表格相关的属性值:table.table-row和table-cell,它也是最后一款支持这些属性值的主流浏览器.它标志着复杂CSS ...
- HTML+CSS小实战案例
HTML+CSS小实战案例 登录界面的美化,综合最近所学进行练习 网页设计先布局,搭建好大框架,然后进行填充,完成页面布局 <html> <head> <meta htt ...
- 2天驾驭DIV+CSS (实战篇)(转)
这是去年看到的一片文章,感觉在我的学习中,有不少的影响.于是把它分享给想很快了解css的兄弟们.本文是实战篇. 基础篇[知识一] “DIV+CSS” 的叫法是不准确的[知识二] “DIV+CSS” ...
- 深入css布局篇(1) — 盒模型 & 元素分类
深入css布局(1)-- 盒模型 & 元素分类 " 在css知识体系中,除了css选择器,样式属性等基础知识外,css布局相关的知识才是css比较核心和重要的点.今天我们来深 ...
- 前端开发周报: CSS 布局方式方式与JavaScript数据结构和算法
前端开发周报:CSS 布局方式与JavaScript动画库 1.常见 CSS 布局方式详见: 一些常见的 CSS 布局方式梳理,涉及 Flex 布局.Grid 布局.圣杯布局.双飞翼布局等.http: ...
随机推荐
- session操作类
using System;using System.Web; /// <summary> ///session操作类 /// </summary> public class a ...
- 前端 HTML form表单标签 select标签 option 下拉框
<select></select> select里面通常跟option配合使用 <!DOCTYPE html> <html lang="en&quo ...
- 011-ThreadFactory线程工厂
一.源码分析 ThreadFactory是一个线程工厂.用来创建线程.这里为什么要使用线程工厂呢?其实就是为了统一在创建线程时设置一些参数,如是否守护线程.线程一些特性等,如优先级.通过这个Tread ...
- c#4.0 Task.Factory.StartNew 用法
var t1 = Task.Factory.StartNew<string>(() => { return “1111111”; }); //t1.Wait(); t1.Contin ...
- vue-cli 3.x脚手架配置并使用vux
https://blog.csdn.net/Honnyee/article/details/82181620
- [转]C++编译链接过程详解
C语言的编译链接过程要把我们编写的一个c程序(源代码)转换成可以在硬件上运行的程序(可执行代码),需要进行编译和链接.编译就是把文本形式源代码翻译为机器语言形式的目标文件的过程.链接是把目标文件.操作 ...
- MyBatis——模糊查询
在mybatis中可以使用三种模糊查询的方式: <!-- 模糊查询 --> <select id="selectListByTitle" parameterTyp ...
- [LeetCode] 130. Surrounded Regions_Medium tag: DFS/BFS
Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A reg ...
- 产品设计教程:wireframe,prototype,mockup到底有何不同?
wireframe,prototype,mockup 三者经常被混用,很多人把三者都叫原型,真的是这样吗? 我们来看看三者到底有何不同.先来做一道选择题: 从这张图可以看出,prototype 和其他 ...
- Hadoop2.6的DataNode启动不了
2016-05-04 18:14:51,990 INFO org.apache.hadoop.ipc.Server: IPC Server Responder: starting 2016-05-04 ...