Master page with DOCType effecting the CSS styles

Last post 07-06-2009 3:55 AM by ushajyothsna. 5 replies.

Sort Posts:

  • Master page with DOCType effecting the CSS styles

    07-03-2009, 4:42 AM
    • Member
      10 point Member
    • ushajyothsna
    • Member since 07-03-2009, 3:23 AM
    • Posts 19

    I am having a same problem which i have used a ajax model popupwindow . to get it it work properly, i added the doctype(

    <!

    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">

    ).

    now my whole website is working wildly. all the css styles have been varied.  i have checked the master page HTML and it is all correct. If i remove the doctype then it works fine.

    Kindly assist me over this. I am using asp.net2.0

    Regards

    Usha

     

  • Re: Master page with DOCType effecting the CSS styles

    07-03-2009, 12:50 PM
    • Contributor
      2,367 point Contributor
    • akhhttar
    • Member since 02-14-2007, 8:17 AM
    • Pakistan - Lahore
    • Posts 352

    Hi Usha,


    I am not sure that xhtml1-loose.dtd is a valid DTD or nto, Try xhtml1-transitional.dtd if you HTML pages are not fully XHTML complaint orusing some deprecated tags.


    Thanks

    Muhammad Akhtar Shiekh

    Lets resolve the problem together.

    Please remember to mark the appropriate replies as answer after your question is solved, thanks

    My Blog
  • Re: Master page with DOCType effecting the CSS styles

    07-03-2009, 5:29 PM
    Answer
    • Contributor
      6,366 point Contributor
    • Lee Dumond
    • Member since 11-03-2004, 2:51 PM
    • Decatur, IL USA
    • Posts 1,168

     The DOCTYPE has no effect on the CSS itself. Rather, the DOCTYPE (or lack of one) affects how the browser renders the page.

    Generally, browsers have two modes - "Standards" mode and "Quirks" mode. There is tons of information on the web about Standard vs. Quirks mode, and how each is triggered by each major browser depending on the included doctype. Each browser is a little bit different.

    In nearly ALL browsers, if the page has no doctype, the page will be rendered in Quirks mode. Basically, this means that it will use the IE5 Box Model to render output. IE5 used a very unorthodox (non-standard) method of interpreting the rendering of margins, borders, and padding for boxes.

    If you never had a doctype before, that means your site has been rendered using Quirks mode all along. And since you developed it that way, you made it look "right" for Quirks mode. The second you add a doctype in there, browsers will render it in Standards mode, which will totally break any "Quirks-mode" site.

    This is always a problem when you attempt to use modern browser technology (like AJAX) in a site which was never properly updated to comply with modern standards.

    Using a different doctype is very unlikely to work, because most likely ANY doctype will force your site into Standards mode, and that is what is causing the trouble.

    I know you won't like hearing this, but the best way to solve this problem is to include doctypes in all your pages and rework the design to render properly in Standards mode.

  • Re: Master page with DOCType effecting the CSS styles

    07-04-2009, 3:08 AM
    • Member
      10 point Member
    • ushajyothsna
    • Member since 07-03-2009, 3:23 AM
    • Posts 19

    Thanks for all the  data given and its all useful for me to know abt DOCTYPES. I searched in net where i could get lots of material.  But nowhere i could understand them. U have provided me in a simple manner. U told me that the best way to handle them is to add in all the pages. It means should i add them in aspx pages also? Moreover how do i know if my html code is following the standards or not?

    Regards 

    Usha

  • Re: Master page with DOCType effecting the CSS styles

    07-05-2009, 6:36 AM
    Answer
    • Contributor
      2,367 point Contributor
    • akhhttar
    • Member since 02-14-2007, 8:17 AM
    • Pakistan - Lahore
    • Posts 352

     Hi Usha,

    You can validate your HTML using W3C Markup validator service.

    http://validator.w3.org/#validate_by_uri

    Thanks

    Muhammad Akhtar Shiekh

    Lets resolve the problem together.

    Please remember to mark the appropriate replies as answer after your question is solved, thanks

    My Blog
  • Re: Master page with DOCType effecting the CSS styles

    07-06-2009, 3:55 AM
    • Member
      10 point Member
    • ushajyothsna
    • Member since 07-03-2009, 3:23 AM
    • Posts 19

    Thanks a lot for the reply

    Regards

    Usha 

Page 1 of 1 (6 items)