Re: shorttags

Discussion in 'HTML' started by Morten Holt, Jul 23, 2008.

  1. Morten Holt

    Morten Holt Guest

    sheldonlg wrote:
    > I am trying to debug an application that is an intranet app behind a
    > firewall accessible only via vpn. The problem I am having is that the
    > tables sorting is now working properly in Firefox 2.
    >
    > Doing a "view source" only yields the template, as the the page is
    > written as a response back from an AJAX call. So, I went to internet
    > explorer and did a javascript:document.write(mainwapper.innerHTML). My
    > intent was to build a page that was close to what the actual page was by
    > doing a "view page" from there and cutting and pasting.
    >
    > The problem with this procedure is that it converts things like id="foo"
    > to id=foo. Doing a validation with W3C then yields tons of errors
    > stating that SHORTTAGS YES needs to be there. Researching how to put it
    > in gave me to info to change the doctype. I don't want to do that, as I
    > want to keep it "strict" and XHTML.
    >
    > How can I get the writing to not strip off the surrounding quotes?

    Did you consider getting the Developer Toolbar extension for Firefox? It
    has a view generated source function. You can then run that through the
    W3C validator.

    >
    > While we are at it, --- and this may sound simple ---, W3C validation
    > with "strict" complains about align="center" for <td>, and about other
    > attributes. How can I write these to accomplish the centering and still
    > be compliant with the "strict"?

    I don't know if align is removed in XHTML, but try setting it in the
    stylesheets instead. HTML shouldn't be used for presentation.

    --
    Morten 'T-Hawk' Holt
    In the joy of anticipation there's the anticipatory
    letdown of anticipating not anticipating anticipation
    of some future anticipation.
     
    Morten Holt, Jul 23, 2008
    #1
    1. Advertising

  2. Morten Holt

    Morten Holt Guest

    sheldonlg wrote:
    >>> While we are at it, --- and this may sound simple ---, W3C validation
    >>> with "strict" complains about align="center" for <td>, and about
    >>> other attributes. How can I write these to accomplish the centering
    >>> and still be compliant with the "strict"?

    >> I don't know if align is removed in XHTML, but try setting it in the
    >> stylesheets instead. HTML shouldn't be used for presentation.

    >
    > What attribute? When I tried style=" and waited for the choices, I
    > didn't see align anywhere in there. Which one will align a <td>?

    The CSS attribute for alignment is text-align. But that's more a CSS,
    than a HTML question. Oh and you should avoid inline styles, if possible.

    --
    Morten 'T-Hawk' Holt
    In the joy of anticipation there's the anticipatory
    letdown of anticipating not anticipating anticipation
    of some future anticipation.
     
    Morten Holt, Jul 23, 2008
    #2
    1. Advertising

  3. Morten Holt

    Stevo Guest

    Morten Holt wrote:
    > sheldonlg wrote:
    >>>> While we are at it, --- and this may sound simple ---, W3C
    >>>> validation with "strict" complains about align="center" for <td>,
    >>>> and about other attributes. How can I write these to accomplish the
    >>>> centering and still be compliant with the "strict"?
    >>> I don't know if align is removed in XHTML, but try setting it in the
    >>> stylesheets instead. HTML shouldn't be used for presentation.

    >>
    >> What attribute? When I tried style=" and waited for the choices, I
    >> didn't see align anywhere in there. Which one will align a <td>?

    > The CSS attribute for alignment is text-align. But that's more a CSS,
    > than a HTML question. Oh and you should avoid inline styles, if possible.


    I've found that only IE aligns all elements according to the text-align
    attribute. Firefox and Safari won't align DIVs, OBJECTS or EMBEDS,
    they'll only align text and images.

    I've had to build a workaround to dynamically add the align="center"
    attribute to DIVs that some page designer has used text-align:center and
    expected that my Div would be centered by it, but only IE respects it.
    I'd always thought the page designed was wrong to use it and said they
    should use align="center" instead. My opinion wasn't based on standards,
    just on what works and what doesn't.
     
    Stevo, Jul 24, 2008
    #3
  4. Stevo wrote:

    > I've found that only IE aligns all elements according to the text-align
    > attribute. Firefox and Safari won't align DIVs, OBJECTS or EMBEDS,
    > they'll only align text and images.


    Of course they do! Images are INLINE elements and divs and objects are
    BLOCK elements. "test-align: /whatever/" applies to INLINE elements not
    BLOCK. One of most common questions here, "how to center {insert block
    element of your choice}"

    STEP 1, give element an explicit width(px if it contains a static px
    size content like an image, em to be proportional to textual content, %
    to be proportional to canvas)

    STEP 2, set the left & right MARGINS on the element( "margin-right:
    auto; margin-left-auto;" or set top & bottom also "margin: 0 auto;" or
    set top &bottom to different values "margin: 0 auto 1em auto;"

    >
    > I've had to build a workaround to dynamically add the align="center"
    > attribute to DIVs that some page designer has used text-align:center and
    > expected that my Div would be centered by it, but only IE respects it.
    > I'd always thought the page designed was wrong to use it and said they
    > should use align="center" instead. My opinion wasn't based on standards,
    > just on what works and what doesn't.


    Vintage 1990's solution--try moving into this millennium.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jul 24, 2008
    #4
  5. Morten Holt

    Stevo Guest

    Jonathan N. Little wrote:
    > Stevo wrote:
    >> I've found that only IE aligns all elements according to the
    >> text-align attribute. Firefox and Safari won't align DIVs, OBJECTS or
    >> EMBEDS, they'll only align text and images.

    >
    > Of course they do! Images are INLINE elements and divs and objects are
    > BLOCK elements. "test-align: /whatever/" applies to INLINE elements not
    > BLOCK. One of most common questions here, "how to center {insert block
    > element of your choice}"
    >
    > STEP 1, give element an explicit width(px if it contains a static px
    > size content like an image, em to be proportional to textual content, %
    > to be proportional to canvas)
    >
    > STEP 2, set the left & right MARGINS on the element( "margin-right:
    > auto; margin-left-auto;" or set top & bottom also "margin: 0 auto;" or
    > set top &bottom to different values "margin: 0 auto 1em auto;"


    I just tried that, it works a treat. Thanks a lot.

    >> I've had to build a workaround to dynamically add the align="center"
    >> attribute to DIVs that some page designer has used text-align:center
    >> and expected that my Div would be centered by it, but only IE respects
    >> it. I'd always thought the page designed was wrong to use it and said
    >> they should use align="center" instead. My opinion wasn't based on
    >> standards, just on what works and what doesn't.

    >
    > Vintage 1990's solution--try moving into this millennium.


    We're all trying our best to keep up ;-)
     
    Stevo, Jul 24, 2008
    #5
  6. Morten Holt

    Stevo Guest

    Stevo wrote:
    > Jonathan N. Little wrote:
    >> Stevo wrote:
    >>> I've found that only IE aligns all elements according to the
    >>> text-align attribute. Firefox and Safari won't align DIVs, OBJECTS or
    >>> EMBEDS, they'll only align text and images.

    >>
    >> Of course they do! Images are INLINE elements and divs and objects are
    >> BLOCK elements. "test-align: /whatever/" applies to INLINE elements
    >> not BLOCK. One of most common questions here, "how to center {insert
    >> block element of your choice}"
    >>
    >> STEP 2, set the left & right MARGINS on the element( "margin-right:
    >> auto; margin-left-auto;" or set top & bottom also "margin: 0 auto;" or
    >> set top &bottom to different values "margin: 0 auto 1em auto;"

    >
    > I just tried that, it works a treat. Thanks a lot.


    I don't actually understand how changing the margin to auto changes it
    from being a block element to an inline element though. It's still the
    same element type. If a DIV is a block, then isn't it still a block when
    it has auto margin? The answer won't change anything for me, it's
    working great now, but I can't help wondering.
     
    Stevo, Jul 24, 2008
    #6
  7. Stevo wrote:
    > Stevo wrote:
    >> Jonathan N. Little wrote:
    >>> Stevo wrote:
    >>>> I've found that only IE aligns all elements according to the
    >>>> text-align attribute. Firefox and Safari won't align DIVs, OBJECTS
    >>>> or EMBEDS, they'll only align text and images.
    >>>
    >>> Of course they do! Images are INLINE elements and divs and objects
    >>> are BLOCK elements. "test-align: /whatever/" applies to INLINE
    >>> elements not BLOCK. One of most common questions here, "how to
    >>> center {insert block element of your choice}"
    >>>
    >>> STEP 2, set the left & right MARGINS on the element( "margin-right:
    >>> auto; margin-left-auto;" or set top & bottom also "margin: 0 auto;"
    >>> or set top &bottom to different values "margin: 0 auto 1em auto;"

    >>
    >> I just tried that, it works a treat. Thanks a lot.

    >
    > I don't actually understand how changing the margin to auto changes it
    > from being a block element to an inline element though.


    It doesn't! It remain a block element it just make the margin on the
    left and right automatically the same. You need to understand what
    margins are:

    http://www.w3.org/TR/CSS21/box.html#box-dimensions


    > It's still the
    > same element type. If a DIV is a block, then isn't it still a block when
    > it has auto margin? The answer won't change anything for me, it's
    > working great now, but I can't help wondering.


    Change the background element of block and see its shape.


    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="content-language" content="en-us">

    <title>Block and Inline</title>

    <style type="text/css">
    div { width: 10em; margin: 1em auto; background: #fdd; }
    p { text-align: center; background: #ddf; }
    </style>
    </head>
    <body>
    <div>I am a 10em block with auto margins</div>
    <p>I am inline text in a paragraph with text-align: center</p>
    </body>
    </html>


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jul 24, 2008
    #7
  8. Gazing into my crystal ball I observed Stevo <> writing
    in news:g6a2mc$6jt$02$-online.com:

    > Stevo wrote:
    >> Jonathan N. Little wrote:
    >>> Stevo wrote:
    >>>> I've found that only IE aligns all elements according to the
    >>>> text-align attribute. Firefox and Safari won't align DIVs, OBJECTS

    or
    >>>> EMBEDS, they'll only align text and images.
    >>>
    >>> Of course they do! Images are INLINE elements and divs and objects

    are
    >>> BLOCK elements. "test-align: /whatever/" applies to INLINE elements
    >>> not BLOCK. One of most common questions here, "how to center

    {insert
    >>> block element of your choice}"
    >>>
    >>> STEP 2, set the left & right MARGINS on the element( "margin-right:
    >>> auto; margin-left-auto;" or set top & bottom also "margin: 0 auto;"

    or
    >>> set top &bottom to different values "margin: 0 auto 1em auto;"

    >>
    >> I just tried that, it works a treat. Thanks a lot.

    >
    > I don't actually understand how changing the margin to auto changes it
    > from being a block element to an inline element though. It's still the
    > same element type. If a DIV is a block, then isn't it still a block

    when
    > it has auto margin? The answer won't change anything for me, it's
    > working great now, but I can't help wondering.
    >


    Declaring margin auto does not change an element from block to inline.
    Since block elements take up 100% of their containing element, declaring
    width and/or height constrains it, and thus allowing auto margin to
    "center" the element.

    To make a block element inline, one would declare "element
    {display:inline}" and conversly, "element {display:block}" to make an
    inline element display as a block element.
     
    Adrienne Boswell, Jul 24, 2008
    #8
  9. Morten Holt

    Tim Streater Guest

    In article <29748$48888ea7$40cba7b7$>,
    "Jonathan N. Little" <> wrote:

    > Stevo wrote:
    > > Stevo wrote:
    > >> Jonathan N. Little wrote:
    > >>> Stevo wrote:
    > >>>> I've found that only IE aligns all elements according to the
    > >>>> text-align attribute. Firefox and Safari won't align DIVs, OBJECTS
    > >>>> or EMBEDS, they'll only align text and images.
    > >>>
    > >>> Of course they do! Images are INLINE elements and divs and objects
    > >>> are BLOCK elements. "test-align: /whatever/" applies to INLINE
    > >>> elements not BLOCK. One of most common questions here, "how to
    > >>> center {insert block element of your choice}"
    > >>>
    > >>> STEP 2, set the left & right MARGINS on the element( "margin-right:
    > >>> auto; margin-left-auto;" or set top & bottom also "margin: 0 auto;"
    > >>> or set top &bottom to different values "margin: 0 auto 1em auto;"
    > >>
    > >> I just tried that, it works a treat. Thanks a lot.

    > >
    > > I don't actually understand how changing the margin to auto changes it
    > > from being a block element to an inline element though.

    >
    > It doesn't! It remain a block element it just make the margin on the
    > left and right automatically the same. You need to understand what
    > margins are:
    >
    > http://www.w3.org/TR/CSS21/box.html#box-dimensions


    Indeed, I would be inclined to start here:

    http://www.w3.org/TR/CSS21/

    and read the lot.
     
    Tim Streater, Jul 24, 2008
    #9
  10. Morten Holt

    Stevo Guest

    Tim Streater wrote:
    > In article <29748$48888ea7$40cba7b7$>,
    > "Jonathan N. Little" <> wrote:
    >> http://www.w3.org/TR/CSS21/box.html#box-dimensions

    > Indeed, I would be inclined to start here:
    > http://www.w3.org/TR/CSS21/
    > and read the lot.


    Oh I'd love to, but I'm hoping my brief foray into CSS has been and gone
    and doesn't come back ;-) We're in-between CSS gurus where I work,
    otherwise I wouldn't have had to find out what the deal was here.

    Thanks again though guys, this rocks :)
     
    Stevo, Jul 24, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. viza

    Re: shorttags

    viza, Jul 24, 2008, in forum: HTML
    Replies:
    0
    Views:
    419
  2. Andy Dingley

    Re: shorttags

    Andy Dingley, Jul 24, 2008, in forum: HTML
    Replies:
    4
    Views:
    417
    Gus Richter
    Jul 25, 2008
  3. BootNic

    Re: shorttags

    BootNic, Jul 24, 2008, in forum: HTML
    Replies:
    2
    Views:
    411
    Thomas 'PointedEars' Lahn
    Jul 25, 2008
  4. RobG

    Re: shorttags

    RobG, Jul 25, 2008, in forum: HTML
    Replies:
    0
    Views:
    449
Loading...

Share This Page