http://www.maxdesign.com.au/articles/inline/

http://www.w3.org/TR/CSS2/visuren.html#inline-boxes

http://www.w3.org/TR/CSS2/visudet.html#q4

inline不认高宽,不认上下的margin,不认overflow,但可以识别padding和左右方向的margin,也有line-height

inline属性的a标签,span标签支持margin-left与margin-right,margin-top无作用,而img标签margin四个方向都支持()。

本文章介绍了inline元素的padding,margin,width,height对元素本身的影响

要点:
块状元素前后元素会换行
行内元素前后元素不会换行

第一:行内元素与宽度
宽度不起作用
span {
    width:200px;
}没有变化

第二:行内元素与高度
高度不起作用  但是高度可有line-height来确定
span{
    height:200px;
}
没用变化

第三:行内元素与padding,margin
span{
    padding:200px;
}
影响左右,不影响上下

如何实现
<ul>
<li>第一</li>
<li>第一</li>
<li>第一</li>
</ul>
中的li在同一行显示并有上下边距呢,
如果用display:inline,可行让其在一行内显示,但上下padding不起作用。
所以这种情况下用float:left;使其在一行内显示,并且其还是block元素,可以用
padding使与上下padding起作用,差生一定距离

The W3C’s CSS2 spec states that for Inline, non-replaced elements, the ‘width’ property does not apply.

The W3C’s CSS2 spec states that for Inline, non-replaced elements, the ‘height’ property doesn’t apply, but the height of the box is given by the ‘line-height’ property.

While padding can be applied to all sides of an inline element, only left and right padding will have an effect on surrounding content.

Margins operate in the same way as padding on inline elements. In the example below, 50px of margin has been applied to all sides of the <a> element. While the left and right edges are effected, the content above and below are not.

li 的padding和margin都正常生效  li是块级元素

Examples of block level elements
Element Description
<address> information on author
<blockquote> long quotation
<button> push button
<caption> table caption
<dd> definition description
<del> deleted text
<div> generic language/style container
<dl> definition list
<dt> definition term
<fieldset> form control group
<form> interactive form
<h1> heading
<h2> heading
<h3> heading
<h4> heading
<h5> heading
<h6> heading
<hr> horizontal rule
<iframe> inline subwindow
<ins> inserted text
<legend> fieldset legend
<li> list item
<map> client-side image map
<noframes> alternate content container for non frame-based rendering
<noscript> alternate content container for non script-based rendering
<object> generic embedded object
<ol> ordered list
<p> paragraph
<pre> preformatted text
<table> table
<tbody> table body
<td> table data cell
<tfoot> table footer
<th> table header cell
<thead> table header
<tr> table row
<ul> unordered list

inline 元素的特性的更多相关文章

  1. inline元素、block元素、inline-block元素

    inline 内联元素:是不可以控制宽和高.margin等:并且在同一行显示,不换行,直到该行排满. block 块级元素:是可以控制宽和高.margin等,并且会换行.块级对象元素会单独占一行显示, ...

  2. 关于block和inline元素的float

    CSS float 浮动属性 本篇主要介绍float属性:定义元素朝哪个方向浮动. 目录 1. 页面布局方式:介绍文档流.浮动层以及float属性. 2. float:left :介绍float为 l ...

  3. inline元素、block元素

    inline元素 不会独占一行,相邻的行内元素会排列在同一行内,直到一行排不下才会换行 高.行高.以及外边距和内边距不可改变 宽度就是它的文字或图片的宽度,不可改变,随元素内容变化而变化 内联元素只能 ...

  4. inline元素导航栏案例

    练习一个超链接元素在文档流当中,a标签显示出来的inline这种元素的特性.我们可以用display来将它转换成inline-block类型,这样我们就可以设置它的高度,宽度和它的背景颜色等等特性了. ...

  5. display:inline-block,block,inline元素的区别

    1.display:block将元素显示为块级元素,从而可以更好地操控元素的宽高,以及内外边距,每一个块级元素都是从新的一行开始.2.display : inline将元素显示为行内元素,高度,行高以 ...

  6. 返本求源——DOM元素的特性与属性

    抛砖引玉 很多前端类库(比如dojo与JQuery)在涉及dom操作时都会见到两个模块:attr.prop.某天代码复查时,见到一段为某节点设置文本的代码: attr.set(node, 'inner ...

  7. 多个inline元素、block元素、inline-block元素在父容器中的换行情况

    1.首先看inine元素的换行情况 <style> *{padding:0;margin:0} div.wrap{width:200px;height:200px;border:1px s ...

  8. inline元素的margin与padding

    替换元素与非替换元素 替换元素(replaced element):所谓替换元素就是浏览器根据元素的标签和属性,来决定元素具体显示什么内容.比如说:img标签的src属性的值用来读取图片信息并且显示出 ...

  9. 当inline元素包裹block元素时会发生什么

    经常有图片链接写法如下: <a href="www.baidu.com"><img src="baidu.jpg" /></a&g ...

随机推荐

  1. python按行读取apk中版本号、包名等信息

    主要是读apk中manifest.xml中的信息. 读单一apk信息:见“文件”中“apkInfo.xml”.实际运行时,需要将后缀由“.xml”改为“.py". 批量自动获取apk软件信息 ...

  2. LeetCode LinkList 23. Merge k Sorted Lists

    这两天一直也没有顾上记录一下自己做过的题目,回头看看,感觉忘的好快,今天做了一个hard,刚开始觉得挺难得,想了两种方法,一种是每次都从k个list中选取最小的一个,为空的直接跳过,再就是每次合并其中 ...

  3. Resharper快捷键及用法

    建议你使用 Reshaper 的快捷键,不要担心 Reshaper 会把你原来的快捷键设置给覆盖了,因为如果某个快捷键和 VS 是冲突的,Reshaper会让你自己选择需要使用 VS 还是 Resha ...

  4. Linux下Java、Maven、Tomcat的安装

    1.安装Java(此处假定安装文件夹位/usr/local) 1)下载jdk(jdk-7),下载地址例如以下: 32位:http://download.oracle.com/otn-pub/java/ ...

  5. fedora20配置静态ip

    在linux的世界里.给主机设置固定ip是这么做的(使用root用户): 1.查看要配的网络接口 用ifconfig查看查看在用的网卡接口,一般都用第一个如:eth0,en1,em1等 2.停用网络自 ...

  6. eventfd

    #include <sys/eventfd.h> int eventfd(unsigned int initval, int flags); eventfd() creates an &q ...

  7. (一)spark算子 分为3大类

    value类型的算子 处理数据类型为value型的算子(也就是这个算子只处理数据类型为value的数据),可以根据rdd的输入分区与输出分区的关系分为以下几个类型 (1)输入分区与输出分区一对一型 m ...

  8. mv 命令 简要

    1.mv  test.txt    test1.txt 给文件重命名 2.mv   test.txt   aaDir   将test.txt文件移动到aaDir文件夹中 3.mv   -t  /hom ...

  9. VMware网络连接 桥接、NAt、host-only模式

    如果你想利用VMWare安装虚拟机,或想创建一个与网内其他机器相隔离的虚拟系统,进行特殊的调试工作.此时,对虚拟系统网络连接模式的选择就非常重要了.如果你选择的工作模式不正确,就无法实现上述目的,也就 ...

  10. 内核源码之Kconfig和Makefile

    转自:http://www.cnblogs.com/image-eye/archive/2011/08/28/2156005.html 内核源码之Kconfig和Makefile Linux内核源码树 ...