在CSS中使用百分比边距,但想要最小边距像素? [英] Using a percentage margin in CSS but want a minimum margin in pixels?

查看:315
本文介绍了在CSS中使用百分比边距,但想要最小边距像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已设置了 margin:0 33%0 0; ,但我也想确保至少 px 金额。我知道在CSS中没有 min-margin ,所以我想知道在这里是否有任何选项?

I have set a margin: 0 33% 0 0; however I would also like to make sure the margin is at least a certain px amount. I know there is no min-margin in CSS so I was wondering if I have any options here?

推荐答案

使用%宽度和静态放置 div > min-width 在元素的右边。

Place a div with a % width and a static min-width to the right of your element.

<div style="position:relative; float:left; margin:0">
<div style="position:relative; float:left; width:33%; min-width:200px">

这篇关于在CSS中使用百分比边距,但想要最小边距像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆