知识点

  • CSS
  • 相关文章

    更多

    最近更新

    更多

    在html使用CSS的方式

    2019-03-01 22:29|来源: 网路

    结合方式01:
       在标签上加入style属性.
       属性的值就是css代码.
    示例:
    <p style="color:red;" >直接在标签上加样式</p>


    结合方式02:

       在页面的head标签中, 书写一个style标签.
       在style标签中书写css代码.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <style type="text/css">
        p {
            color:blue;
        }
    </style>
    </head>
    <body>
    <p>text1</p>
    <p>text2</p>
    </body>
    </html>


    结合方式03:

       在页面head标签中填写link标签
               <link type="text/css" rel="stylesheet" href="p.css" />
               type mime类型
               rel     类型
               href css文件路径
    示例:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
        <link type="text/css" rel="stylesheet" href="p.css" />
    </head>
    <body>
    <p>引入css文件</p>
    <p>引入css文件</p>
    </body>
    </html>

    p.css

    p {
        color:pink;    
    }


    转自网络


    相关问答

    更多