Html – How to use if else condition to change doctype according to the browser in html file.

html

We are working on :hover pseudo-class in IE 7, which works only if the docktype is

< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">

,but it decrement the font size of all element

please help me ..

Best Answer

HTML itself doesn't have any built-in server-side processing. Therefore, it doesn't have the ability to alter itself prior to the response going out.

You have access to javascript, but this is done on the client side, and at that point the browser has already interpreted the doc type.

If you are using a server-side programming language to generate your HTML, then you could include an if statement there, although changing the doctype just so that styling will work correctly is a questionable practice...