Ask a questionAsk a question
 

QuestionIE8: Default CSS values in Developer Tools?

  • Sunday, April 05, 2009 12:47 PMoctothorp Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    How to see CSS declarations that browser applies by default?
    In Developer Toolbar for IE 6 and 7 I used to check "Show default style values" in bottom-right corner, and it showed me all CSS properties for current element with current applied values, marked default browser styles with gray.
    From this I knew, for example, that 'h1' has font-size: 24pt by default, and that body has margin: 10px 15px by default.
    But I see nothing similar in Developer Tools for IE 8. It only shows styles from author's style sheet, not from browser's settings. It is rather inconvinient.
    Please help me to know whether there's a way to inspect default styles in IE 8.

All Replies

  • Monday, April 13, 2009 7:48 AMIECUSTOMIZERMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi,

    Either use a different tool - Firebug lite or DebugBar

    or

    Use the script tab of developer tools to query the style rules of an element.

    alert(document.body.style.height);


    However, there is no tool that will show you the rules applied by a UserStylesheet.


    I usually have a 'primer' stylesheet that applies my (well actually the W3C recommendations) for rule defaults. You will find that not all browsers (and versions there of)  apply the same defaults. Using a priming stylesheet puts all browsers on the same playing field. (FYI, Firefox and Opera also add a stylesheet to every page to 'prime' the rule defaults. html.css)

    Prior to IE8, you had to use "HasLayout" to force the default rules to be applied to an element.


    ADDRESS,
    BLOCKQUOTE, 
    BODY, DD, DIV, 
    DL, DT, 
    FIELDSET, FORM,
    FRAME, FRAMESET,
    H1, H2, H3, H4, 
    H5, H6, IFRAME, 
    NOFRAMES, 
    OBJECT, OL, P, 
    UL, APPLET, 
    CENTER, DIR, 
    HR, MENU, PRE   { display: block }
    LI              { display: list-item }
    HEAD            { display: none }
    TABLE           { display: table }
    TR              { display: table-row }
    THEAD           { display: table-header-group }
    TBODY           { display: table-row-group }
    TFOOT           { display: table-footer-group }
    COL             { display: table-column }
    COLGROUP        { display: table-column-group }
    TD, TH          { display: table-cell }
    CAPTION         { display: table-caption }
    TH              { font-weight: bolder; text-align: center }
    CAPTION         { text-align: center }
    BODY            { padding: 8px; line-height: 1.33 }
    H1              { font-size: 2em; margin: .67em 0 }
    H2              { font-size: 1.5em; margin: .83em 0 }
    H3              { font-size: 1.17em; margin: 1em 0 }
    H4, P,
    BLOCKQUOTE, UL,
    FIELDSET, FORM,
    OL, DL, DIR,
    MENU            { margin: 1.33em 0 }
    H5              { font-size: .83em; line-height: 1.17em; margin: 1.67em 0 }
    H6              { font-size: .67em; margin: 2.33em 0 }
    H1, H2, H3, H4,
    H5, H6, B,
    STRONG          { font-weight: bolder }
    BLOCKQUOTE      { margin-left: 40px; margin-right: 40px }
    I, CITE, EM,
    VAR, ADDRESS    { font-style: italic }
    PRE, TT, CODE,
    KBD, SAMP       { font-family: monospace }
    PRE             { white-space: pre }
    BIG             { font-size: 1.17em }
    SMALL, SUB, SUP { font-size: .83em }
    SUB             { vertical-align: sub }
    SUP             { vertical-align: super }
    S, STRIKE, DEL  { text-decoration: line-through }
    HR              { border: 1px inset }
    OL, UL, DIR,
    MENU, DD        { margin-left: 40px }
    OL              { list-style-type: decimal }
    OL UL, UL OL,
    UL UL, OL OL    { margin-top: 0; margin-bottom: 0 }
    U, INS          { text-decoration: underline }
    CENTER          { text-align: center }
    BR:before       { content: "\A" }
    
    /* An example of style for HTML 4.0's ABBR/ACRONYM elements */
    
    ABBR, ACRONYM   { font-variant: small-caps; letter-spacing: 0.1em }
    A[href]         { text-decoration: underline }
    :focus          { outline: thin dotted invert }
    
    
    /* Begin bidirectionality settings (do not change) */
    BDO[DIR="ltr"]  { direction: ltr; unicode-bidi: bidi-override }
    BDO[DIR="rtl"]  { direction: rtl; unicode-bidi: bidi-override }
    
    *[DIR="ltr"]    { direction: ltr; unicode-bidi: embed }
    *[DIR="rtl"]    { direction: rtl; unicode-bidi: embed }
    
    /* Elements that are block-level in HTML4 */
    ADDRESS, BLOCKQUOTE, BODY, DD, DIV, DL, DT, FIELDSET, 
    FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, IFRAME,
    NOSCRIPT, NOFRAMES, OBJECT, OL, P, UL, APPLET, CENTER, 
    DIR, HR, MENU, PRE, LI, TABLE, TR, THEAD, TBODY, TFOOT, 
    COL, COLGROUP, TD, TH, CAPTION 
                    { unicode-bidi: embed }
    /* from PositionisEverything */
    a {
    	text-decoration: none;
    	font-weight: bold;
    	outline: none;
    	}
    a:visited {
    	}
    a:active {
    	}
    a:hover {
    	text-decoration: underline;
    	}
    strong, b {
    	font-weight: bold;
    	}
    hr {
    	margin: 0px; /* fixes xhtml N6 bug where the hr sits to the left*/
    	color: #ccc; /* for ie */
    	background-color: #ccc; /* for everyone else */
    	height: 1px;
    	}
    p {
    	font-size: 90%;
    	line-height: 1.1em;
    	margin-top: 1.5em;
    	margin-bottom: 1.5em; 
    	}
    li {
    	font-size: 90%;
    	line-height: 1.1em;
    	margin-top: 0.3em;
    	margin-bottom: 0.2em; 
    	}
    ul {
    	margin-top: 1.0em;
    	margin-bottom: 1.0em; 
    	}
    td {
    	font-size: 90%;
    	}
    hr {
    	margin-top: 2.0em;
    	margin-bottom: 2.0em;
    	}
    img {
    	border: 0;
    	}
                    
                    
    
    



    Regards.
    Rob^_^