1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

CSS中乍样定义内容图片大小,防止撑破布局

本帖由 OUYANG2006-11-14 发布。版面名称:前端开发

  1. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    我是这样做的,但想要更好的方法

    img {
    max-width: 550px; width:expression(this.width > 550 ? "550px" : this.width)
    }
     
  2. myrrh

    myrrh New Member

    注册:
    2005-09-18
    帖子:
    61
    赞:
    2
    这在ie6 里头还不是很好用 往往图片要刷新一次才能正常

    一般还是用js实现
     
  3. Hoofei

    Hoofei New Member

    注册:
    2005-12-10
    帖子:
    3,162
    赞:
    35
  4. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    把JS拿出来用用
     
  5. Hoofei

    Hoofei New Member

    注册:
    2005-12-10
    帖子:
    3,162
    赞:
    35
    我没有...:mummy:
     
  6. zouql

    zouql New Member

    注册:
    2005-11-27
    帖子:
    312
    赞:
    4
  7. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    DZ的贴子内容显示
    跟一个CMS生成HTML好像相差很多吧
     
  8. xledoo

    xledoo New Member

    注册:
    2005-11-15
    帖子:
    109
    赞:
    0
    不用也可以。。用 clear:both;