美文网首页
浮动元素的值

浮动元素的值

作者: p了个f | 来源:发表于2018-07-23 13:24 被阅读13次
  • float:left 元素向左浮动

效果图


1.png

源代码

css

        .left{
            float: left;
            width: 200px;
            height: 200px;
            background-color: orange;
        }

html

<body>
<div class="warp">
    <div class="left"></div>
</div>
</body>
  • float:right 元素向右浮动

效果图


2.png

源代码

css

        .right{
            float: right;
            width: 200px;
            height: 200px;
            background-color: purple;
        }

html

<body>
<div class="warp">
    <div class="right"></div>
</div>
</body>
  • float:none 默认值。元素不浮动,安装正常的文档流排列方式

效果图


3.png

源代码

css

        .left{
            float: none;
            width: 200px;
            height: 200px;
            background-color: orange;
        }
        .right{
            float: none;
            width: 200px;
            height: 200px;
            background-color: purple;
        }

html

<body>
<div class="warp">
    <div class="left"></div>
    <div class="right"></div>
</div>
</body>
  • float:inherit 规定应该从父元素继承float属性的值

效果图


4.png

源代码

css

        .warp{
            float:left;
        }
        .left{
            float: inherit;
            width: 200px;
            height: 200px;
            background-color: orange;
        }
        .right{
            float: inherit;
            width: 200px;
            height: 200px;
            background-color: purple;
        }

html

<body>
<div class="warp">
    <div class="left"></div>
    <div class="right"></div>
</div>
</body>

相关文章

  • CSS浮动

    float属性的值: left:元素向左浮动 right:元素向右浮动 none:元素不浮动 inherit:从父...

  • 中科笔试题

    1、设置元素浮动后,该元素的display值是? 答案:设置元素为浮动后,display的值是block。 2、[...

  • CSS-布局笔记摘抄

    [浮动] 使用float来设置元素浮动 可选值 none - 默认值,不浮动,元素在文档流中 left right...

  • 浮动元素的值

    float:left 元素向左浮动 效果图 源代码 css html float:right 元素向右浮...

  • 十九,浮动:float属性

    float属性设置:1,left--元素向左浮动2,right--元素向右浮动3,none--默认值。元素不浮动。...

  • HTML----浮动、定位

    浮动 所谓浮动指的是使元素脱离原来的文本流,在父元素中浮动起来。浮动使用float属性,可选值:.none:不浮动...

  • HTML----浮动、定位

    浮动 所谓浮动指的是使元素脱离原来的文本流,在父元素中浮动起来。浮动使用float属性,可选值:.none:不浮动...

  • HTML—盒子模式(2)

    浮动 所谓浮动指的是使元素脱离原来的文本流,在父元素中浮动起来。浮动使用float属性。可选值:none:不浮动l...

  • CSS浮动定位BFC边距合并

    浮动元素有什么特征?对父容器,其他浮动元素,普通元素,文字分别有什么影响? 浮动的框可以随float的属性值左右移...

  • 浮动、清除浮动

    一、浮动属性有哪些属性值 float • left 元素向左浮动• right ...

网友评论

      本文标题:浮动元素的值

      本文链接:https://www.haomeiwen.com/subject/iazdmftx.html