Do we still need forward slashes when closing void elements in HTML5?

In HTML 5, the closing slash is optional on void elements such img (I am adding this because the currently accepted answer only says: “end tags must not be specified for void elements”, and does not address closing slashes in void elements). Citing from http://www.w3.org/TR/html5/syntax.html#start-tags (number 6): Then, if the element is one of the … Read more

How do I center align horizontal menu?

From http://pmob.co.uk/pob/centred-float.htm: The premise is simple and basically just involves a widthless float wrapper that is floated to the left and then shifted off screen to the left width position:relative; left:-50%. Next the nested inner element is reversed and a relative position of +50% is applied. This has the effect of placing the element dead … Read more

display: inline-block extra margin [duplicate]

White space affects inline elements. This should not come as a surprise. We see it every day with span, strong and other inline elements. Set the font size to zero to remove the extra margin. .container { font-size: 0px; letter-spacing: 0px; word-spacing: 0px; } .container > div { display: inline-block; margin: 0px; padding: 0px; font-size: … Read more

Are nested span tags OK in XHTML?

Yes it will. You can help yourself by using the w3’s validator direct input option: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en”> <head> <title>Title</title> </head> <body> <p> <span>Test<span>Nest span</span></span> </p> </body> </html>

How to parse XML in Bash?

This is really just an explaination of Yuzem’s answer, but I didn’t feel like this much editing should be done to someone else, and comments don’t allow formatting, so… rdom () { local IFS=\> ; read -d \< E C ;} Let’s call that “read_dom” instead of “rdom”, space it out a bit and use … Read more

Valid content-type for XML, HTML and XHTML documents

HTML: text/html, full-stop. XHTML: application/xhtml+xml, or only if following HTML compatbility guidelines, text/html. See the W3 Media Types Note. XML: text/xml, application/xml (RFC 2376). There are also many other media types based around XML, for example application/rss+xml or image/svg+xml. It’s a safe bet that any unrecognised but registered ending in +xml is XML-based. See the … Read more

Is div inside list allowed? [duplicate]

Yes it is valid according to xhtml1-strict.dtd. The following XHTML passes the validation: <?xml version=”1.0″?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <title>Test</title> </head> <body> <ul> <li><div>test</div></li> </ul> </body> </html>