What is the difference between HTML tags
and ?

后端 未结 13 1322
时光取名叫无心
时光取名叫无心 2020-11-22 05:48

I would like to ask for some simple examples showing the uses of

and . I\'ve seen them both used to mark a section of a pa
13条回答
  •  梦如初夏
    2020-11-22 06:22

    The real important difference is already mentioned in Chris' answer. However, the implications won't be obvious for everybody.

    As an inline element, may only contain other inline elements. The following code is therefore wrong:

    This is a paragraph

    The above code isn't valid. To wrap block-level elements, another block-level element must be used (such as

    ). On the other hand,
    may only be used in places where block-level elements are legal.

    Furthermore, these rules are fixed in (X)HTML and they are not altered by the presence of CSS rules! So the following codes are also wrong!

    Still wrong

    Just as wrong

提交回复
热议问题