height = 2px和height = 2有什么区别?当我们不指定像px或em这样的单位时,它需要什么单位?height = 2px和height = 2有什么区别
1
A
回答
0
如果你指的是HTML那么它将永远是像素。如果是CSS,它将取决于浏览器,并且取决于您分配高度的元素,例如line-height:2将表示该行上字体值的200%。当前的浏览器将其指定为CSS中的无效值,并且不应呈现大小。
0
它不应该工作。
如果选中的开发工具,你会发现这条消息height: 50;
无效的属性值
因为你要加上单位,让浏览器知道如何使你的元件。
0
那么,这是无效的。
您可以使用铬工具(F12)检查元素,从中删除'px',并接收无效值的警告。
0
使用这个链接试试高度= 100和height = 100 px.understand各色的 http://www.w3schools.com/cssref/tryit.asp?filename=trycss_position_bottom
+0
我认为它没有正常工作 –
相关问题
- 1. 在CSS中,line-height:1.5和line-height:150%有什么区别?
- 2. 在PlayN Graphics界面中,height和screenHeight方法有什么区别?
- 3. “object-fit:contains”和“max-width:100%; max-height:100%”有什么区别?
- 4. img元素上的HTML width/height属性和CSS width/height属性有什么区别?
- 5. 用`height = device-height`设置元视口标签有什么效果?
- 6. Parent div,height not set,over-sizes height by several pixels to fit child img element height?为什么?
- 7. iFrame和“max-height”
- 8. JS“Window”width-height vs“screen”width-height?
- 9. Ionic 2:Slider auto height
- 10. sIFR3和line-height/leading
- 11. flex measuredHeight vs height
- 12. Monotouch:UITableViewCell height
- 13. 3/2和-3/2有什么区别?
- 14. CSS:min-height和vertical-align:middle
- 15. jquery animate height bouncing
- 16. HTML/CSS Div(height:80px)over Div(height:100%;)
- 17. three.js shape holes height
- 18. $(document).height()no workey
- 19. 什么是Flex 3.x中的$ height?
- 20. 为什么min-height不起作用?
- 21. 使用$(parent.window).height()
- 22. Ujquery height arrangement
- 23. Bootstrap main 100 height
- 24. CSS,Textareas和iframes - height%s
- 25. Animate PickerView Height Swift
- 26. webpack 1和webpack 2有什么区别?
- 27. jquery $(window).height()和$(document).height()返回相同的
- 28. New Theme.AppCompat ActionBar height
- 29. tinymce iframe height
- 30. getHeight()vs getLayoutParams()。height
在CSS中没有“默认”单位。单位是非零值所必需的。所以'height = 2'根据css标准是无效的。请参见[this](http://stackoverflow.com/questions/2272279/css-default-units)问题。 – Adam