doubaoxue5788
2018-08-14 18:23
浏览 156
已采纳

如何删除mpdf中的块元素边距?

I noticed that block elements (ex. div) have some kind of margins by default, and it seems I cannot reset them via css. So how to? does anyone know?

图片转代码服务由CSDN问答提供 功能建议

我注意到块元素(例如div)默认有某种边距,看起来我无法重置 他们通过CSS。 怎么样? 有谁知道吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dqc2017 2018-08-16 07:16
    已采纳

    Ok, further investigation took me to the following findings:

    Basically, you cannot use other than really simple/direct selectors. No nested selectors are allowed (like .class p, or ul li), so:

    • think ahead and structure your document in a really simple manner so you don't have to use nested selectors or something more complicated. For example, do not use nested lists (ul li ul)

    • write your css all with ultra simple direct selectors (one element or one class)

    • then you can reset all the margins and paddings of block elements, if/when/where needed.

    点赞 打赏 评论
  • duanli6834 2018-08-14 18:27

    Define your margin. E.g; you have class named as me. So browser is using own agent stylesheet. What you have to do is to apply t margin to same class. Remember your CSS will override that. So your code will look like .me {margin:0}. Then the margin will not be applied. Hope this helps

    点赞 打赏 评论

相关推荐 更多相似问题