css之基础及布局属性

css之基础及布局属性


1.CSS三种关联方式

行间样式
  如<p style=”color:#f00” >divcss8</p>
内联表方式
  

  (1):先在<head></head>之间加上<style>*********样式***********</style>

  (2):html里面采用选择器 调用所有的样式;

  <head>

  <style>
    div{color:red  font-weight:hold}
  </style>
  </head>
  <div></div>


  外联表方式

  • 外联表的原则:结构(html)与表现(css)进行分离
  • 在css文件夹里新建文件,写样式,在原html文件中写<link href=“css/css.css”rel=“stylesheet” type=“text/css”>  (放在head里面)

2.常用样式选择器

  <div>
  <p>文本</p>
  <div class=“body”></div>
  <div id=“top”></div>
  </div>

  • html标记符选择器:选择原页面上的元素;在css样式中 div{color:red; border:1px solid #000; width:200px;height:200px;}
  • 有上下文关系的定义:div p{color:blue;}
  • 选择定义类(class)选择器:.body{color:yellow}   
  • id选择器:只能唯一存在;#top{color:pink}

 

 

转载于:https://www.cnblogs.com/fxty/p/7044297.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值