Skip to main content

Posts

Showing posts with the label XHTML

Asp.NET Strict XHTML - Form Name Attribute

Generated XHTML by the .NET environment can throw an error if creating strict XHTML 1.1 as defined by <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> The .NET environment adds the attribute "name" to the "Form" tag, which is not valid, strict XHTML 1.1 as shown in the screen shot below when validating against the W3C service. Screen shot of W3C Strict XHTML 1.1 validation error To remove this error, the .NET environment needs to be told to generate strict XHTML, as opposed to transitional XHTML or HTML or some other format. This can be done by adding "<xhtmlConformance mode="Strict"/>" to the web.config file within the system.web node e.g. <?xml version="1.0"?> <!--      Note: As an alternative to hand editing this file you can u...

IE8 Rendering Issues

IE8 is a vast improvement on IE6 in terms of rendering HTML and CSS; however now and again there still seem to be some oddities compared to other browsers. Having spent the best part of a day trying to debug the code which had been validated by  http://validator.w3.org/  (as XHTML 1.1 Strict  ) and  http://jigsaw.w3.org/css-validator/  (as CSS 2.1), IE8 was still having trouble rendering the page and was drawing a div twice. Ultimately it boiled down to an anchor tag being closed in short form. i.e. <a id="someAnchor" />. After changing this to <a id="someAnchor"></a>, everything worked fine and was bang on again in IE8. Lesson learnt that if IE8 appears to be rendering incorrectly, check which tags are being closed in which way. Not saying this is the answer to every rendering issue in IE8 but it's something to look out for if HTML and CSS code is perfectly valid, rendering correctly in all other browsers (Chrome, Firefox, Safari, etc.),...