CSS基础练习
-----------------------------------------------
链接外面文件css
<link href="layout.css" rel="stylesheet" type="text/css" />
-----------------------------------------------
写文本 : <div id="mainContent">
<p>1列固定宽度居中+头部+导航+尾部——<a href="http://www.aa25.cn">标准之路 </a></p>
-----------------------------------------------
加上下间隔
<br class="clearfloat" />
-----------------------------------------------
加回车
<p>This is the sidebar<br />
<br />
This is the sidebar<br />
<br />
This is the sidebar </p>
-----------------------------------------------
#layout {
border: 2px solid #A9C9E2;
background-color: #E8F5FE;
height: 200px;
width: 300px;
margin:0px auto;
}
margin属性用于控制对象的上、右、下、左四个方向的外边距,当margin使用两个参数时,第一个参数表示上下边距,第二个参数表示左右边距。除了直接使用数值之外,margin还支持一个值叫auto,auto值是让浏览器自动判断边距,在这里,我们给当前div的左右边距设置为auto,浏览器就会将div的左右边距设为相当,并呈现为居中状态,从而实现了局中效果。
-----------------------------------------------
#right{
background-color:#999999;
border:3px; solid #333;
width: 200px;
height: 50px;
float:left;
}
float 属性定义元素在哪个方向浮动。 ,,,简单说为显示 左右2个列.
-----------------------------------------------
position 用于设置对象的定位方式
#layout {
position:absolute;
top:20px;
left:0px;
}
-----------------------------------------------
相关文档:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>Cross-Browser Text Glow Demo</title>
<mce:style type="text/css"><!--
* {
font ......
css渐变代码4种
一、从上往下渐变
body{
FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#000000);
}
二、从左上至右下渐变
body{
FILTER: Alpha( style=1,opacity=25,finishOpacity=100,
startX=50,finishX= 100,startY=50,finishY=100);
background-col ......
filter:alpha(opacity=50);-moz-opacity:0.5;
Opacity: 相对于IE。火狐似乎好像不支持。 值:以百分比为值,100 表示不透明度为100%;50侧代表不透明度为50%。
-moz-opacity: 相对于FF,火狐。 值:以小数点为值,1 表示不透明度为100%;0.5侧代表不透明度为50%。
注意:上面的滤镜IE8不支持。因此我们需要用 <meta h ......
CSS 和 JavaScript 标签 style 属性对照表:
盒子标签和属性对照
CSS语法(不区分大小写) JavaScript语法(区分大小写)
border border
border-bottom borderBottom
border-bottom-color borderBottomColor
border-bottom-style borderBottomStyle
border-bottom-width borderBottomWidth
border-color bor ......