zoukankan      html  css  js  c++  java
  • overflow:hidden lineheight clear:both用法

    1.overflow:hidden的作用是隐藏溢出
    比如:
    <div style="300px;overflow:hidden" id="1"><div id="2"></div><div>

    当ID=2的这个DIV高度设定的宽度超过了300px,那么超出的部分将自动被隐藏

      2.line-height指的是在DIV中的元素上下居中

    比如用在<li>里,则可以将line-height的高度和height的值相等,(height:30px; line-height:30px;)这样可以让文字在<li>内相对于30px垂直居中。
    比如用在<p>内,像这样成段落的,如果不加line-height,行与行之间距离会很近,若在<p>属性内加上line-height:22px;则每行之间的行距都是22px,会显得不会太拥挤.

    3.clear:both清除浮动
    当css样式设置为float的时候,html里面的内容不会在文档流里面占位置,新的内容可能会覆盖在原来的上面,所以在添加新内容之前,加入如下html代码:
    <div class="clear"></div>

    css样式为

    .clear{
    clear:both ;
    }

    这样就可以实现清除浮动了
  • 相关阅读:
    阅读代码
    openSips
    rc.local 问题
    MyBatis框架使用(一)
    【数据结构杂谈】
    【AGC052A】
    【杜教筛学习笔记】
    CF618F Double Knapsack
    [NOI2016] 循环之美
    【BZOJ 4668 冷战】
  • 原文地址:https://www.cnblogs.com/cuiyf/p/2850884.html
Copyright © 2011-2022 走看看