例子
思韵闪耀
2010-09-30
0

1,<a href=”http://www.w3schools.com/css/tryit.asp?filename=trycss_float5“>导航条</a>

body{
font-family: “宋体”;
font-size: 12px;
//对于页面中出现的文字,如外部没有CSS,就用这个CSS,默认。即最外层的CSS影响它所包含的内部所有元素,若其没有自己的CSS,则外部的应用之,对应应用。因为如td之类没有字体之类的属性,这种对应指的是外部CSS属性与元素含有的属性的交。
如: td
{
font-size:12px;s
}
对页面中td内的文字应用。

background-color: #F8FDF8;
margin: 0px auto;
}

2, 连接:link:正常显示 visited: 点击过后 hover: 鼠标滑过 active: 鼠标按下时
a.link {
font-size: 12px;
line-height: 22px;
color: #333333;
text-decoration: none;
}
a:visited {
font-size: 12px;
line-height: 22px;
color: #333333;
text-decoration: none;
}
a:hover {
font-size: 12px;
line-height: 22px;
color: #009900;
text-decoration: none;
}
a:active {
font-size: 12px;
line-height: 22px;
color: #333333;
text-decoration: none;
}

注: visited要在a:link之后。 active要在hover之后才会有效果。
3, 当控件获得焦点时进行样式操作
&lt;html&gt;
&lt;head&gt;
&lt;style type=”text/css”&gt;
input:focus
{
background-color:yellow;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form action=”form_action.asp” method=”get”&gt;
First name: &lt;input type=”text” name=”fname” /&gt;&lt;br /&gt;
Last name: &lt;input type=”text” name=”lname” /&gt;&lt;br /&gt;
&lt;input type=”submit” value=”Submit” /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

3, 图片由半透明转为透明

&lt;html&gt;
&lt;head&gt;
&lt;style type=”text/css”&gt;
img
{
opacity:0.4; //firefox的用法,范围从0.0 – 1.0
filter:alpha(opacity=40) //ie的用法,范围从0 – 100
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;Image Transparency&lt;/h1&gt;
&lt;img src=”klematis.jpg” width=”150″ height=”113″ alt=”klematis”
onmouseover=”this.style.opacity=1;this.filters.alpha.opacity=100″
onmouseout=”this.style.opacity=0.4;this.filters.alpha.opacity=40″ /&gt;

&lt;/body&gt;
&lt;/html&gt;

4, 改变html的表现形式: 如input text 这个文本框让其只有下线,改变其边框颜色
&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “<a href=”http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>”&gt;
&lt;html xmlns=”<a href=”http://www.w3.org/1999/xhtml”>http://www.w3.org/1999/xhtml</a>”&gt;
&lt;head&gt;
&lt;meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ /&gt;
&lt;title&gt;无标题文档&lt;/title&gt;
&lt;style&gt;
input {
border-color:red;
border-left-width:0px;
border-right-width:0px;
border-top-width:0px;}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
sdf
&lt;input name=”" type=”text” /&gt;sfd
&lt;/body&gt;
&lt;/html&gt;

5, 百度输入栏:高度为28px, 而google为21px, 而中文高度比英文字母要繁,高度要高,显然百度的输入栏更符合输入中文。
&lt;input name=”" type=”text” autocomplete=”off”/&gt;
input[type="text"]{font:16px Verdana;height:28px;padding-top:2px} //改变html元素显示形状
注:页面要去掉头部的&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “<a href=”http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>”&gt;


【版权声明】
本站部分内容来源于互联网,本站不拥有所有权,不承担相关法律责任。如果发现本站有侵权的内容,欢迎发送邮件至masing@13sy.com 举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

相关内容

热门资讯

Invalid left-ha... 写一个提交函数的时候,发现函数不生效,F12之后看到Invalid left-hand side i...
响应图片(Responsive... 一、开门见山 响应图片技术可以说是响应布局衍生出来的一个小分支。说白了,就是不同显示器宽度下调用不同...
轻松删除MetInfo CMS... 第一步:首页底部版权,模板文件foot直接删除; 第二部:首页头部generator版权,\publ...
ckplayer6.3如何替换... 1.刚打开播放器,视频在缓冲时播放器中间的LOGO怎么替换?(如下图) 2.视频播放器右上角的CK ...
inDensity,inTar... 如果接触Android中的Bitmap较深的话,肯定会知道标题上的这三个属性值,那么这三个属性值的关...
JS 验证 利用Javascript中每个对象(Object)的prototype属性我们可以为Javascri...
在文本框中输入时保证总是在最... 那就要在keypress时保证文本框的光标在尾部,而文本框value赋值后其光标默认在最后,故可采用...
微信UA Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5...
检测大写锁定键(Caps Lo... h1检测大写锁定键/h1form action="#" method="post" p label ...
iframe高度自适应,全屏,... !注意此方法用于同一个域名下,可能需要部署在服务器上才能看出效果 !DOCTYPE html PUB...