Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: shorttags

Reply
Thread Tools

Re: shorttags

 
 
Morten Holt
Guest
Posts: n/a
 
      07-23-2008
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.
 
Reply With Quote
 
 
 
 
Morten Holt
Guest
Posts: n/a
 
      07-23-2008
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.
 
Reply With Quote
 
 
 
 
Stevo
Guest
Posts: n/a
 
      07-24-2008
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.
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      07-24-2008
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
 
Reply With Quote
 
Stevo
Guest
Posts: n/a
 
      07-24-2008
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
 
Reply With Quote
 
Stevo
Guest
Posts: n/a
 
      07-24-2008
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.
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      07-24-2008
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
 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      07-24-2008
Gazing into my crystal ball I observed Stevo <(E-Mail Removed)> writing
in news:g6a2mc$6jt$02$(E-Mail Removed)-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.
 
Reply With Quote
 
Tim Streater
Guest
Posts: n/a
 
      07-24-2008
In article <29748$48888ea7$40cba7b7$(E-Mail Removed)>,
"Jonathan N. Little" <(E-Mail Removed)> 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.
 
Reply With Quote
 
Stevo
Guest
Posts: n/a
 
      07-24-2008
Tim Streater wrote:
> In article <29748$48888ea7$40cba7b7$(E-Mail Removed)>,
> "Jonathan N. Little" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: shorttags BootNic HTML 2 07-25-2008 09:22 PM
Re: shorttags Andy Dingley HTML 4 07-25-2008 08:10 AM
Re: shorttags RobG HTML 0 07-25-2008 12:25 AM
Re: shorttags viza HTML 0 07-24-2008 05:51 AM



Advertisments