CSS:span元素margin-top无效的根源
来源:互联网 发布:中文.商城域名骗局 编辑:程序博客网 时间:2024/06/05 08:24
span默认是行属性,而div默认是块属性。
对行内元素(不包括可替换元素如img等):
1. 设置宽度width 无效。
2. 设置高度height无效,可以通过line-height来设置高度。
3. 设置margin只有左右margin有效,上下无效。(这就是span的margin-top无效的原因)
4. 设置padding只有左右padding有效,上下则无效。
块级元素的width/height/margin/padding都是有效的
解决办法:把span强制设为块属性就可以了。
0 0
- CSS:span元素margin-top无效的根源
- CSS:span元素margin-top无效的根源
- 在CSS中span标签设置padding-top/bottom以及margin-top/bottom无效的解决方法
- margin-top无效的解决方法
- 关于margin-top/bottom在non-Replaced inline元素上(如span)不起作用的解释
- css margin-top设置html元素之间的距离
- margin-top无效解决方法
- 父元素与子元素之间的margin-top问题(css hack)
- 父元素与子元素之间的margin-top问题(css hack)
- 父元素与子元素之间的margin-top问题(css hack)
- 父元素与子元素之间的margin-top问题(css hack)
- CSS:子元素margin-top影响父元素
- CSS top、margin-top和padding-top的区别
- 相邻元素的 margin-top重叠问题
- css盒模型(由问题第一个子元素设置margin-top不起作用引发的新发现)
- CSS中margin-top对父级元素产生作用的问题
- CSS中margin-top对父级元素产生作用的问题
- 子元素的margin-top值会使父元素也出现margin-top值问题
- bootstrap collapse 控件学习
- flipsnap 控件学习
- display : table table-row rable-cell
- html控件中设置两个样式渲染
- odoo之Qweb的一些参数
- CSS:span元素margin-top无效的根源
- Unity3d开发(十六) 重写UGUI组件
- 经典的01背包问题
- ASCII码排序
- 宏定义(#define)和常量(const)的区别
- Firefox中元素获取焦点函数focus不起作用的解决方法
- ANT批量执行Jmeter脚本
- debug 加载程序原理
- iOS 如何自定义控件组件