Web开发 第二部分 CSS基础(二) CSS书写规范
1、三种不同的样式表
样式表根据其书写位置不同,共分为三种:
内联样式表(inline):该样式表写在标签的style属性里,负责设置当前标签的样式;
内部样式表(inner):该样式表一般写在head标签的style标签里,通过选择器来指定某个样式所影响的标签;
外部样式表(external):该样式表一般写在独立的*.css文件里,通过选择器来指定某个样式所影响的标签,在head标签通过link标签引入外部样式文件;
看一个例子,共两个文件,在同一个目录中:
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<!-- 这里引入了一个外部样式表 -->
<link type="text/css" rel="stylesheet" href="style.css" mce_href="style.css" />
<!-- 这是一个内部样式表 -->
<mce:style type="text/css" ><!--
b { /* 这是一个标签选择器 */
background-color:#B0D1E6;
color:blue;
text-indent:2em;
text-align:left;
}
.title { /* 这是一个类选择器 */
color:#209DA4;
text-decoration:underline;
text-align:left;
}
#id1 { /* 这是一个ID选择器 */
background-color:#5E5E5E;
color:#FFFFFF;
font-weight:bold;
height:100px;
width: 300px;
border: 2px dotted #C7784E;
word-break:break-all;
overflow-y:auto;
overflow-x:hidden;
text-indent:2em;
margin:0 auto;
}
--></mce:style><mce:style type="text/css" mce_bogus="1"><!--
b { /* 这是一个标签选择器 */
background-color:#B0D1E6;
color:blue;
text-indent:2em;
text-align:left;
}
.title { /* 这是一个类选择器 */
color:#209DA4;
text-decoration:underline;
text-align:left;
}
#id1 { /* 这是一个ID选择器 */
background-color:#5E5E5E;
color:#FFFFFF;
font-weight:bold;
height:100px;
width: 300px;
border: 2px dotted #C7784E;
word-break:break-all;
overfl
相关文档:
/* 禁止换行 */
.nowrap{word-break:keep-all;white-space:nowrap;}
/* 强制换行 */
.break{word-break:break-all;}
css强制不换行
div{white-space:nowrap;}
css自动换行
div{ word-wrap: break-word; word-break: normal; }
css强制英文单词断行
div{word-break:break-all;}
大家都知道连续的英文或数字会把DIV ......
/* reset */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,p,blockquote,th,td{margin:0;padding:0;font-family:'宋体';}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,a,span {overflow:hidden;}
table{border-collapse:collapse;border-spacing:0; font-size:12px;}
td { line-height:18px ......
css是什么?这是初学网页设计的同学们遇到的第一个问题,在学习网页制作之前,你一定要了解网页制作的大局,有了全局的了解,才知道怎么去学习。
网页设计分为:前台页面设计,后台程序设计。
前台页面设计分为:html,css,javasript,ps,flash(这几个都要了解哦,熟练掌握css)
后台程序设计分为:asp,php,asp.net(只要 ......
CSS分栏布局的方法:绝对定位和浮动
出处:网页教学网
作者:佚名
日期:2009-03-09
在CSS中,实现分栏布局有两种方法。第一种方法是使用四种CSS定位选项(absolute
、static、relative和fixed)中的绝对定位(absolute
positioning),它可以将文档中的某个元素从其原本位置上移除,并重新定位 ......
来自:http://www.51xflash.com/website/html/200905/01-8904.html
CSS代码: (插入到CSS文件的最顶端)
html { filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); }
或者:
*{filter: Gray;}
HTML代码: (插入到页面HTML源码的<HEAD>和</HEAD>之间)
<style>html{filter:progid:DXIm ......