zoukankan      html  css  js  c++  java
  • css浮动,网页练习显示、定位

    1、浮动

    浮动框可以向左或向右移动,直到外边缘碰到包含框或另一个浮动框边框为止。

    float:left; float:right; clear:both;

    img{float:right}

    清除浮动方法:

    1》父级元素后加元素:<div style=”clear:both”></div>

    2》父级元素加::after{display:block;content:” ”;clear:both}

    3》overflow:hidden

    练习网页:

    2、显示display:规定元素应该生成的框的类型

    display:block;块级元素显示div

    display:inline;内联元素显示span

    display:inline-block;行内块元素

    display:flex;弹性盒子

    display:none元素隐藏

    3、定位(难点)

    position: static(默认,没有定位);   fixed(绝对定位,相对浏览器);   relative(相对定位,相对正常位置);   absolute(绝对定位,相对不是static的父元素定位);

    fixed和absolute是不占据空间的,fixed不设置top,是相对于原来位置显示

    top:

    left:

    right:

    bottom:

    z-index:设置元素的堆叠顺序

  • 相关阅读:
    达梦常用命令
    sqlserver命令
    db2常用命令
    docker常用命令
    linux常用命令
    vim常用命令
    cpu、内存、io、内存、负载
    3.系统状态监控
    10 innodb之关键特性刷新邻接页
    9 innodb关键特性之自适应哈希索引03
  • 原文地址:https://www.cnblogs.com/mark645524126/p/13228191.html
Copyright © 2011-2022 走看看