V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iugo
V2EX  ›  程序员

分享一个尴尬时刻, CSS

  •  
  •   iugo ·
    iugo · 2020-03-10 11:59:31 +08:00 · 3106 次点击
    这是一个创建于 1523 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在留白的时候, 写 padding: 2rem, 10rem, 然后不能用, 当时还很烦躁, 怎么就不能用呢?

    借口: 很久不写 CSS 了, 不熟悉嘛. 🙈

    11 条回复    2020-03-10 21:59:54 +08:00
    zhoufenfens
        1
    zhoufenfens  
       2020-03-10 12:50:39 +08:00
    因为是行内元素
    miao666
        2
    miao666  
       2020-03-10 12:53:14 +08:00 via Android
    分割用空格,不是逗号
    huguotai
        3
    huguotai  
       2020-03-10 13:00:48 +08:00
    padding: 2rem 10rem;即可
    noobsheldon
        4
    noobsheldon  
       2020-03-10 13:07:02 +08:00   ❤️ 3
    update user set user_type = 2 and name = "jack" where id = 1; 怎么老是不生效啊
    Mutoo
        5
    Mutoo  
       2020-03-10 13:07:04 +08:00
    padding: 2rem/*,*/10rem
    zhw2590582
        6
    zhw2590582  
       2020-03-10 13:10:04 +08:00
    用 sass 没烦恼
    llb123
        7
    llb123  
       2020-03-10 13:29:02 +08:00
    F12 不就知道错哪了么。。
    CloudMx
        8
    CloudMx  
       2020-03-10 14:04:17 +08:00
    @noobsheldon update user set user_type = 2 and name = "jack" where id = 1; -->
    你要表达的意思是?:
    update user set user_type = 2,name = "jack" where id = 1;
    iugo
        9
    iugo  
    OP
       2020-03-10 15:35:55 +08:00
    都像 noobsheldon 一样多好. 谁还没个脑抽抽的时候, 来, 舞台给大家.
    mostkia
        10
    mostkia  
       2020-03-10 17:05:38 +08:00
    首先,如果不是块级元素,有时候会出现 padding 加不上去的情况,比如 em、span、i、b 等这类标签,默认情况下内内边距加上去也没什么用,而外边距都只能加左右两边。如果需要定义这类标签得边距,请使用 display:block,或者使用 display:inline-block 来初始化。还有,你发上来的语法是错的,css 参数分割不需要逗号,可能你吧其他语言的习惯带进来了。
    indev
        11
    indev  
       2020-03-10 21:59:54 +08:00
    padding: 2rem 10rem;
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3076 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:05 · PVG 19:05 · LAX 04:05 · JFK 07:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.