博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
unity 施加力量_在空块元素上施加宽度
阅读量:2519 次
发布时间:2019-05-11

本文共 1180 字,大约阅读时间需要 3 分钟。

unity 施加力量

One of the side effects within CSS that I find somewhat strange is that even if you give an element an explicit width, the element width is not respected if the element is empty or the elements within it are absolutely or fixed position.  Of course the simple solution is adding   to the given element, but something about that is undesirable:  the height of that element will vary due to the font-size of said element.  For one recent case, the side-effect changed the layout of the page.  Eeek!  For my case, I needed to keep the element width but with minimal effect on height.  Luckily there's an easy solution!

我发现有些奇怪CSS副作用是,即使给元素指定了明确的宽度,如果元素为空或元素内的元素处于绝对或固定位置,也不会考虑元素的宽度。 当然,简单的解决方案是添加  给定元素的大小,但是不希望出现这样的情况:该元素的高度会因该元素的字体大小而变化。 对于最近的一种情况,副作用改变了页面的布局。 eek! 就我而言,我需要保持元素的宽度,但对高度的影响最小。 幸运的是,有一个简单的解决方案!

CSS (The CSS)

The solution amounts to using the min-height property:

该解决方案等于使用min-height属性:

.myElement {  min-height: 1px;}

Setting a minimum height on the the element causes its width to be respected, and since 1px is the smallest height possible, that's the most unobtrusive solution!

在元素上设置最小高度会导致其宽度受到尊重,并且由于1px是可能的最小高度,因此这是最不引人注意的解决方案!

翻译自:

unity 施加力量

转载地址:http://igswd.baihongyu.com/

你可能感兴趣的文章
LVS简略介绍
查看>>
hdu 1021 Fibonacci Again
查看>>
JVM架构_XmnXmsXmxXss有什么区别:转
查看>>
PHPExcel 使用心得
查看>>
洛谷 P3374 【模板】树状数组 1(单点加,区间和)
查看>>
verilog 代码编写小记
查看>>
PyQT的安装和配置
查看>>
从 docker 到 runC
查看>>
守护进程
查看>>
第十二周作业
查看>>
php数组
查看>>
Linux 防火墙
查看>>
互联网金融P2P主业务场景自动化测试
查看>>
array_filter函数的应用
查看>>
梅西确定代言 中国首秀牵手Mate 8
查看>>
html,body
查看>>
一个Brushes笔画应用ios源码完整版
查看>>
IOS 网络浅析-(七 JSON解析之三方JSONKit)
查看>>
image的srcset属性
查看>>
vs + Qt 环境下配置QCustomPlot编译不通过
查看>>