not showing up in xHTML? Why is
not displayed in xHTML? If I do

Why is <div style = "width: 50%" / "> not showing up in xHTML?

Why is <div style="width:50%" />not displayed in xHTML? If I do <div style="width:50%"> &nbsp; </div>, then it is displayed. Did I miss something? Did min-width help? I use strict xHTML 1.0

Is it possible to fix this only with CSS or change the html markup?

+3
source share
3 answers

Because it is DIVnot a self-closing element in XHTML or HTML.

You must connect the open tag ( <div>) with the closure ( </div>).

For another part of your question:

<div style="width:50%">&nbsp;</div>

<div style="width:50%"></div>

, , DIV. . , .

, XML XHTML - . , .

+10

XHTML <div /> ( , , HTML), XHTML: .

<div></div>

- , . ; .

<div>&nbsp;</div>

- , . line-height.

, div , :

<div style="width: 50%; height: 2em; background: red;"></div>

IE5, div - , . ( , HTML XHTML, Transitional Strict), .

+5

The allowed self-closing tags in XHTML are as follows:

<area />
<base />
<basefont />
<br />
<hr />
<input />
<img />
<link />
<meta />

A div must have both start and end tags.

+4
source

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


All Articles