zoukankan      html  css  js  c++  java
  • HTML 引用Css样式的四种方式

    不才,只知道HTML引用CSS样式有四种方式,内部引用和外部引用各两种,因为老是忘记细节,记下了随时翻阅亦可方便如我般的初学者

    内部引用方式1:

       直接在标签内用 style 引用,如:

    <div class="pmc" style="border:1px solid #440000;padding=0px;margin:40px;"> </div> 
    
    

    内部引用方式2:

      在页面头文件的<style></style>标签里引用,如:

    如此话,style 标签最好放到<head>标签里面,不过我试过没放进去也是可以的
    <head>
    <style type="text/css">
    		
    	body{padding:50px;margin:20px;padding:0px;background:#ffffff;line-height:21px}
    	.pmc{margin:10px; padding:8px 0px 10px 5px; height:auto; border-bottom:1px solid #e8e5e5;}
    	.pmc .title{ padding-bottom:5px;}
    	.pmc .pic{ 78px; height:100px; float:left; border:1px solid #ff0000; }
    	.pmc .price{ padding:17px 0px 0px 20px; float:left; color:#ca0000;}
    	.pmc .price.title{ padding-bottom:5px;}
    	
    	#test{border:1px solid #440000; 200px;height:100px;}
    </style>
    </head>

    外部引用方式1:

      用<link>标签,如:

    注意:不要放到页面头部的<style>标签里面,且href可不转义:即<pre name="code" class="html">href="D:learncss.css" =》 href="D:\learn\css.css"
    <link REL="STYLESHEET" type="text/css" href="D:learncss.css" />
    

    
    

    外部引用方式2:

      用@import 方式,如:

     注意:这种方式一定要放到<style></style>里面,并且一定要用转义:即 url("D:\learn\css.css") 只能这样,不能 url("D:learncss.css")
    @import url("D:\learn\css.css");
    
    

    顺便说一声:id比clas优先

    以上均为个人经验,仅供参考!



  • 相关阅读:
    CS224n, lec 10, NMT & Seq2Seq Attn
    CS231n笔记 Lecture 11, Detection and Segmentation
    CS231n笔记 Lecture 10, Recurrent Neural Networks
    CS231n笔记 Lecture 9, CNN Architectures
    CS231n笔记 Lecture 8, Deep Learning Software
    CS231n笔记 Lecture 7, Training Neural Networks, Part 2
    pytorch坑点排雷
    Sorry, Ubuntu 17.10 has experienced an internal error
    VSCode配置python插件
    tmux配置与使用
  • 原文地址:https://www.cnblogs.com/xiaxiaolu/p/4367150.html
Copyright © 2011-2022 走看看