进行页面设计,分享DIV+CSS一些小规则
在进行页面设计的时候,相信下面这些东西应该能够帮助你,DIV+CSS,希望可以为你节省一点时间。
一、 善用css缩写规则
/*注意上、右、下、左的书写顺序*/
1. 关于边距(4边):
1px 2px 3px 4px (上、右、下、左)
1px 2px 3px (省略的左等于右)
1px 2px (省略的上等于下)
1px (四边都相同)
2. 简化所有:
*/ body{margin:0}------------表示网页内所有元素的margin为0
#menu{ margin:0}------------表示menu盒子下的所有元素的margin为0
3. 缩写(border)特定样式:
Border:1px solid #ffffff;
Border-width:0 1px 2px 3px;
4. 关于文字的缩写规则:
Font-style:italic; 斜体形式
Font-variant:small-caps/normal; 变体样式:小型大写字母/正常
Font-weight:bold;
Font-size:12px;
Line-height:1.2em(120%)/1.5em(150%);
Font-family:arrial,sans-serif,verdana;
缩写成:
Font:italic small-caps bold 12px/1.5em arrial,sans-serif;
注意:Font-size和Line-height用斜杠组合在一起不能分开写。
5. 关于背景图片的:
Background:#FFF url(log.gif) no-repeat fixed top left;
6. 关于列表:
List-style-type:square/none;
List-style-position:inside;
List-style-image:url(filename.gif);
缩写成:
List-style:none inside url(filename.gif);
二、 运用4种方法来引入CSS样式
1.link
<link rel=”stylesheet” type=”text/css” href=”a.css”>
rel 关系
type 数据类型,有多种
href 路径
部分浏览器支持候选样式,关键字:alternate:
<link rel=”stylesheet” type=”text/css” href=”a.css”>
<link rel=”alternate stylesheet&
相关文档:
这些都是之前学习的时候总结的,现在把它们都上传上来:
DIV+CSS面试八个题是之前在哪个网站看到了,现在怎么也找不到了,索性自己留一份吧!
一、超链接访问过后hover样式就不出现的问题?
被点击访问过的超链接样式不在具有hover和active了,解决方法是改变CSS属性的排列顺序: L-V-H-A
二、IE6的双倍边距BUG
......
<html>
<body>
<table class="t FCK__ShowTableBorders" cellspacing="0" cellpadding="8" width="600" border="0">
<tbody>
<tr>
&n ......
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#wai{
width:500px;
height:500px;
background-color: #990;
}
#nei {
float:left;
width:200p ......
// 按字符换行
style="word-break: break-all;"
// 按词组换行
style="word-wrap: break-word;"
==========================================================================
==========================================================================
font-family:Ari ......