Html DIV and SPAN Tags

Can I use the DIV tag function as a SPAN tag? that is, removing line breaks before and after the div tag.

+3
source share
3 answers

Yes, use CSS

display: inline
+7
source

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

+6
source

, display: inline;, beware ...

, display: inline; display: inline-block; , :

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

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

+3

Source: https://habr.com/ru/post/1764453/


All Articles