CSS那些事儿

CSS那些事儿

相邻选择器 +

/* 代表着从一个div相邻的div,也就是2,3等等 */
    div+div{
      background-color:black;
    }
/* 代表着从一个div相邻的div的响铃的div,也就是3...等等 */
    div+div+div{
      background-color:black;
    }

通过浮动来实现自适应的问题(通过清除浮动的方法)

1.两列自适应结构
.content-box{
      margin: 10px 0;
    }
    /* 如果只通过clear:both的话 那么margin-bottom的话就不会显示 */
    .content-box::after{
      display: block;
      content: '';
      //还占原先位置
      visibility: hidden;
      clear: both;
      font-size: 0;
      line-height: 0;
    }
    .left-box{
      float: left;
      width: 70%;
      background-color: lightblue;
    }
    .right-box{
      float: right;
      width: 30%;
      background-color: blue;
    }
2.单列定宽单列自适应结构
  1. 可以通过清除浮动的方法
  2. 可以通过绝对定位的方法(问题就是不能够撑大父级)
.content-box{
      position:relative;
      margin: 10px 0;
      background: url('./apic27858.jpg') repeat-y 0 0;
    }
    /* 如果只通过clear:both的话 那么margin-bottom的话就不会显示 */
    .left-box{
      float: left;
      /* 要加空格 */
      width:calc(100% - 200px);
      margin-right: 200px;
      background-color: lightblue;
      color: red;
    }
    .right-box{
      position: absolute;
      right: 0px;
      top: 0px;
      float: right;
      width: 200px;
      margin-left: -200px;
      background-color: blue;
    }
3.等高结构

1.可以通过background的方法来实现

background: url('./apic27858.jpg') repeat-y 0 0;

2.可以通过负边距来实现

父级
overflow:hidden
子级
margin-bottom: -9999px;
padding-bottom: 9999px;
4.两列定宽中间自适应结构

(左侧定宽中间和右侧自适应,三列宽度自适应。这两种和两列定宽中间自适应方法类似.)

HTML
<div class="content-box">
    <div class="right-box">
      <div class="content">2</div>
    </div>
    <div class="left-box">2</div>
    <div class="end-box">2</div>
  </div>
CSS
  .content-box{
      margin: 10px 0;
    }
    .content-box::after{
      display: block;
      clear: both;
      content: '';
      font-size: 0;
      line-height: 0;
      visibility: hidden;
    }
    /* 如果只通过clear:both的话 那么margin-bottom的话就不会显示 */
    .right-box{
      float: left;
      width: 100%;
      background-color: #ffffff;
    }
    .right-box .content{
      margin: 0 200px 0 200px;
      background-color: #000000;
    }
    .left-box{
      float: left;
      /* 要加空格 */
      width:200px;
      margin-left: -100%;
      background-color: lightblue;
      color: red;
    }
    .end-box{
      float: left;
      width: 190px;
      margin-left: -190px;
      background-color:purple;
    }

首字下沉(first-letter)
首行下沉(first-line)

链接操作

LoVe HAte
link visited hover active

input修改边框的简易方法

  1. 首先先去除input的轮廓
  2. 最后设置边框就可以
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值