CSS样式

一、内部样式表

1、选择器:

<html>
  <head>
    <title>内部样式表</title>
    <style type="text/css">
      body{                //body是选择器
    background-color:red;    
      }
      table{
    text_align:center        //table是选择器
      }
      h1{                //h1是选择器
    color:red
      }
      p{                //p是选择器
        text-decoration:underline;    
      }
    </style>
  </head>
</html>
<html>
  <head>
    <title>内部样式表</title>
    <style type="text/css">
      body{
    background:red url(http://www.baidu.com) no-repeat    //分别表示颜色、背景图片、背景图片是否重复。他们之间用空格 区分
      }
    </style>
  </head>
</html>

2、伪类:
<html>
  <head>
    <title>内部样式表</title>
    <style type="text/css">
      /**
    link:    从未访问过的连接
    visited: 已经访问过的链接
    active:  得到焦点的连接
    hover:   鼠标悬停时
      */
      a:link{
    color:red;
    font-size:400px;
      }
    </style>
  </head>
</html>

二、外部样式表
1.在style目录下定义一个style.css文件,内容:
    body{
      background-color:red;
    }
2.在html文件里引用上面的样式:
    <html>
      <head>
        <title>引用外部样式</title>
        <link rel="stylesheet" type+"text/css" ref="style/style.css"/>
      </head>
    </html>

三、还有ID选择器和类别选择器


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值