css简要笔记

css样式的优先级

权重:
id:1000
class:10
多个class权重累加,.div1 .p1{ width: 10px; }大于一个class
标签:1

内联样式>头部样式>外部导入样式
外部导入样式,<link rel="stylesheet" href="css/Test.css"> 靠后的优先级高。
同个文件中靠后的优先级高。

css伪类–例如:hover

https://www.runoob.com/css/css-pseudo-classes.html

a:hover {color:#FF00FF;}   鼠标划过的按钮表单等
a:active {color:#0000FF;}   已选中的链接 

input:focus   有光标闪烁的表单
input:checked { }  选中的checkbox

p:first-child
{
    color:blue;
}

p:before   之前插入内容
{
content:"Read this: ";
}

p:after   之后插入内容
{
content:"- Remember this";
}



宽高的计算

一般情况下, div的真实宽高=width+padding

.div2 {
    width: 300px;
    height: 100px;
    padding: 50px;
    border: 1px solid red;
    box-sizing: border-box;   /* 增加这个使得真实宽高等于width, 不用做加法运算了*/
}

flex布局

http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html

举例情况 div.mainBody下面有3个div.items, 原始默认是从上到下,从左到右排列.

  1. flex-direction: row;
    在这里插入图片描述
 .mainBody{
    display: flex;    // flex默认是row, 排列在同一行, 从左到右
    flex-direction: row;   // 
  }
  .items{
    width: 200px;
    height: 100px;
    border: 1px solid red;
  }
  1. flex-direction: column;

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值