width为宽度
max-width为最大宽度
如果设置了width,那宽度就定死了,不能动态的改变,显得僵硬
而设置了max-width,实际宽度可以在0~max-width之间,当元素内部宽度不足max-width时,外层元素的宽度随内层元素宽度改变
何时用max-width要看需求,如果是极其简单的布局使用width就够了

max-width和width的区别的更多相关文章

  1. CSS width:100%和width:auto的区别

    width:100%和width:auto的区别 width:auto比较聪明,如果margin已经左右占去10px的空间,那么width给的值就是580px. <style> div{ ...

  2. 详解 $().css('width')和$().width()的区别

    在本次项目开发中,经常用jquery获取高度和宽度并且动态加载,有时候用$().css('width')或$().width()这两个方法获取宽度并设置,但是有时候出现获取不到的情况,查阅资料后发现他 ...

  3. width:auto 和 width:100%有什么区别

    width:auto 和 width:100%有什么区别 宽度计算不同 <div class="parent"> <span class="child& ...

  4. offsetHeight/Width clientHeight/Width scrollHeight/Width等高宽算法

    图解: jquery里的对应取法: clientHeight/Width:innerHeight/Width(), offsetHeight/Width: outerHeight/Width(). w ...

  5. android:layout_height、android:layout_width、android:height、android:width的关系与区别

    一直一来对android:layout_height.android:layout_width.android:height.android:width这几个属性的关系有些不理解,既然有了androi ...

  6. clientX、pageX、scrollLeft、offsetLeft、clientWidth、screen.width的用法和区别

    一.定义和用法 1.event.clientX:事件对象的水平偏移量: event.clientY:事件对象的垂直偏移量: 2.event.pageX:事件对象加上滚动距离后的水平偏移量: event ...

  7. style.width与offsetWidth的区别

    1. style.width只能读取内联样式,offsetWidth都可以读取: 2. style.width读取的值带“px”单位,offsetWidth读取纯数值: 3. style.width获 ...

  8. JQuery .width()/.css("width")方法 比较

    1. 获取到的值的区别 获取到的为实际宽度,不包括 内边距 和 边框: <div id="aa"> ...... </div> // 1. width() ...

  9. np.max() 和 np.maximum()的区别

    1.np.max(a, axis=None, out=None, keepdims=False) 求序列的最值 最少接受一个参数 axis默认为axis=0即列向,如果axis=1即横向 ex: &g ...

  10. numpy中np.max() 和 np.maximum() 的区别

    np.max(a, axis=None, out=None, keepdims=False) # 接收一个参数a # 取a 在 axis方向上的最大值 np.maximum(x, y) # 接收两个参 ...

随机推荐

  1. 带parent指针的successor求解

    题目: 给定一个二叉树和其中的一个结点,请找出中序遍历顺序的下一个结点(不存在重复数据).树中的结点不仅包含左右子结点,同时包含指向父结点的指针. 思路: 如果当前节点有右孩子,则下一个节点是右孩子中 ...

  2. [Swift]LeetCode401. 二进制手表 | Binary Watch

    A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom ...

  3. [Swift]LeetCode414. 第三大的数 | Third Maximum Number

    Given a non-empty array of integers, return the third maximum number in this array. If it does not e ...

  4. [Swift]LeetCode458. 可怜的小猪 | Poor Pigs

    There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. Th ...

  5. [Swift]LeetCode547. 朋友圈 | Friend Circles

    There are N students in a class. Some of them are friends, while some are not. Their friendship is t ...

  6. linux入门--Linux系统的优缺点

    1) 大量的可用软件及免费软件 Linux 系统上有着大量的可用软件,且绝大多数是免费的,比如声名赫赫的 Apache.Samba.PHP.MySQL 等,构建成本低廉,是 Linux 被众多企业青睐 ...

  7. scala调用Linux命令行

    在 scala 里面存在 调用 Linux 命令行的函数: import scala.sys.process._ 执行的方法也不难: import scala.sys.process._ /** * ...

  8. Python内置函数(53)——repr

    英文文档: repr(object) Return a string containing a printable representation of an object. For many type ...

  9. 【netty】(1)---BIO NIO AIO演变

    BIO NIO AIO演变 Netty是一个提供异步事件驱动的网络应用框架,用以快速开发高性能.高可靠的网络服务器和客户端程序.Netty简化了网络程序的开发,是很多框架和公司都在使用的技术. Net ...

  10. Zabbix系列之七——添加磁盘IO监测

    zabbix给我们提供了一些较常用的监控模板,但现在我们如果想要监控我们磁盘的IO,这时候zabbix并没有给我们提供这么一个模板,所以我们需要自己来创建一个模板来完成磁盘IO的监控. 1. [roo ...