zoukankan      html  css  js  c++  java
  • 编写css代码的方式

     
       
      css(层叠样式表) 在一个网页中主要负责了页面的数据样式。
       
      编写css代码的方式:
       
      第一种: 在style标签中编写css代码。 只能用于本页面中,复用性不强。
       
      格式 :
       
      <style type="textcss">
      编写css的代码。
      </style>
      例子:
      <style type="textcss">
      a{
      color:#F00;
      text-decoration:none;
      }
      </style>
       
      第二种: 可以引入外部的css文件。 推荐使用。
       
      方式1: 使用link标签。 推荐使用...
      格式:
      <link href="css文件的路径" rel="stylesheet">
       
      例子: <link href="1.css" rel="stylesheet"/>
       
      方式2:使用<style>引入
       
      格式:
      <style type="text/css" >
      @import url("css的路径");
      </style>
       
      例子:
      <style type="text/css" >
      @import url("1.css");
      </style>
       
      第三种方式:直接在html标签使用style属性编写。 只能用于本标签中,复用性较差。 不推荐使用。
       
      例子:
      <a style="color:#0F0; text-decoration:none" href="#">新闻的标题1</a> 
    <style type="text/css">
    /*
        html的注释:<!-- html的注释 -->
    
        
        css /* css的注释 ..*/
        
    /*    
    */
        
    
    </style>
    <body>
        <h1>标题1</h1>
        <a style="color:#0F0; text-decoration:none" href="#">新闻的标题1</a>
        <a href="#">新闻标题2</a>
        <a href="#">新闻标题3</a>
        <a href="#">新闻标题4</a>
        <a href="#">新闻标题5</a>
        <a href="#">新闻标题6</a>
    </body>
  • 相关阅读:
    P2176 [USACO14FEB]路障Roadblock
    洛谷 P1187 3D模型
    洛谷 P2777 [AHOI2016初中组]自行车比赛
    洛谷P2896 [USACO08FEB]一起吃饭Eating Together
    洛谷P2983 [USACO10FEB]购买巧克力Chocolate Buying
    洛谷 P2858 [USACO06FEB]奶牛零食Treats for the Cows
    Restaurant
    OR in Matrix
    poj 3321Apple Tree
    Codeforces Round #204 (Div. 2) C. Jeff and Rounding
  • 原文地址:https://www.cnblogs.com/linst/p/5723460.html
Copyright © 2011-2022 走看看