开发者

Html DIV and SPAN tags

Can I make DIV tag function as SPAN tag? i开发者_如何学Go.e., removing line-break before and after the DIV tag.


Yes, use CSS

display: inline


DIVs are block level elements which means they have a default display:block - give it display:inline (which SPANs have) to override this. Please be a good programmer and do this with CSS not inline styles :)


As others have said, generally you can use display: inline; but beware of the beast...

Make sure you're aware of differences between browsers on display: inline; and display: inline-block; and when you might want to use which:

http://www.brunildo.org/test/InlineBlockLayout.html

http://www.brunildo.org/test/inline-block.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜