html+css+js系列之三 css的入门

参考: 韩顺平 轻松搞定网页设计

1.在没有css之前,先看一个效果图


背后的css1.html是这样实现的:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>css1</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  </head>
  
  <body>
	<span style="font-size:30px;color: blue;">栏目一</span><br/>
	<span style="font-size:10px;color: blue;font-style:italic;">栏目二</span><br/>
	<span style="font-size:40px;color: green;font-weight: bold;">栏目三</span><br/>
	<span style="font-size:20px;color: pink;font-weight:lighter">栏目四</span><br/>
	<span style="font-size:30px;color: black;font-weight:lighter"">栏目五</span><br/>
  </body>
</html>

所有的样式都写在html页面中,看起来比较啰嗦,不利索。

2.为html添加css

效果图


test.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>test.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  <link rel="stylesheet" href="test.css" type="text/css"></link></head>
  
  <body>
  <font class = "style0">梁山英雄排行榜</font><br/>
  <span class = "style1">宋江</span><br/>
  <span class = "style2">卢员外</span><br/>
  <span class = "style3">吴用</span><br/>
  <span class = "style2">豹子头</span><br/>
  <span class = "style2">大刀关胜</span><br/>
  
  <br/>
  <a href="#">goto sohu1中文</a><br/>
  <a href="#">goto sohu2换句话</a><br/>
  <a href="#">goto sohu3各位高</a><br/>
  <a href="#">goto sohu4阿文哥</a><br/>
  <a href="#">goto sohu5问题</a><br/>
     
  </body>
</html>

引入的test.css如下


@CHARSET "UTF-8";
.style0{
	color:yellow;
	font-size: 30px;
	}
.style1{	
	color: red;
	font-style: italic;
	}

.style3{
	font-style: italic;
	text-decoration: underline;
	}

.style1,.style2,.style3{
	background-color: gray;
	font-weight: bold;
	}
	

a:link{
	color:red;
	font-size:24px;
	font-family: 华文新魏;
	text-decoration: none;	
	}
a:hover{
	color:green;
	font-size:40px;
	font-family: 宋体;
	text-decoration: underline;	
	}
a:visited{
	color: gray;
	}





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值