473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HTML Formatting in .NET 2.0

Hello all, ive been programming with ASP.NET since it came out, but am just
getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered with 2.

I use tables to layout my pages, doing three rows, a header, content and
footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.

With 2.0/2005 though, when it renders the pages, it doesnt actually render
at 100% height (even though the code is in the ViewSource of the page).
the table only goes as high as the content forces it, as if the height were
not set at all.

Ive traced it to this line put in by the designer:

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

Is there a way to turn this off, so the designer doesnt put this line out,
so that my tables will render properly? I tried using the Insert Table
wizard, and specifying the height of 100% but it the same problem as
manually coding it.

Oh, also, it tells me the "align" attribute is obsolete on the table tag,
and i should use the newer construct, but it doesnt tell me what that is...
what is considered the "right" way to align a table in the center of the
page now?

Thanks in advance,
Arthur Dent
Dec 21 '05 #1
4 1581
Tools|Options|TextEditor|HTML|Validation is where you can turn this off.

You should be aware, though, that the reason this is used is because XHTML
will eventually supercede HTML on the WWW. This is a good thing. HTML has
become increasingly complex and unpredictable across many browsers. The
formatting rules for it are not strict enough, and it is not easily
extensible. XML in general, and XHTML specifically, are much more extensible
than HTML. XML follows some very strict but simple formatting rules. For
example, elements can not overlap. Opening tags must always be followed by
closing tags. Attributes must always be quoted. These things will eventually
cause all browsers to render content in the same way. But some things you
are now doing may not work correctly in browsers in the future. Learning the
XHTML standard, or at least the transitional standard, will prevent a lot of
future headaches for you, though they may cause you a few in the short run
(learning them, that is).

XHTML relies on styles almost exclusively, rather than attributes. This is
also a good thing. Putting CSS styles into an external style sheet, or at
least in a style sheet in the <head> of the document separates the layout
presentation rules from the HTML objects themselves, which makes it much
easier to change the way your documents look. Inline attributes (and inline
CSS styles) "lock" the appearance into the structure of the object, making
it difficult to find, identify, and change the way the elements look and
behave. The use of external CSS style sheets also allows you to use the same
style sheet for many documents, which is also a very good thing.

Many attributes are already deprecated. The "height" attribute has not been
a part of the standard since at least HTML 3.2, and I'm not sure if it ever
was. The "width" attribute of a table has been recently deprecated. All of
this is heading towards the use of CSS for this type of thing.

So, I gave you the means to turn it off, and a few reasons not to. Now the
ball is in your court!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:eL**************@TK2MSFTNGP14.phx.gbl...
Hello all, ive been programming with ASP.NET since it came out, but am
just getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered with
2.

I use tables to layout my pages, doing three rows, a header, content and
footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.

With 2.0/2005 though, when it renders the pages, it doesnt actually render
at 100% height (even though the code is in the ViewSource of the page).
the table only goes as high as the content forces it, as if the height
were not set at all.

Ive traced it to this line put in by the designer:

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

Is there a way to turn this off, so the designer doesnt put this line out,
so that my tables will render properly? I tried using the Insert Table
wizard, and specifying the height of 100% but it the same problem as
manually coding it.

Oh, also, it tells me the "align" attribute is obsolete on the table tag,
and i should use the newer construct, but it doesnt tell me what that
is... what is considered the "right" way to align a table in the center of
the page now?

Thanks in advance,
Arthur Dent

Dec 21 '05 #2
Okay, i understand all that, and it makes sense. And given that i would
agree it would be
better to find the "new & improved" way of styling my tags as opposed to
turning off the
validation tag.
I still have some questions then though about the specific styles of HEIGHT
and ALIGN.

HEIGHT does not seem to do anything even when i put it in the style of the
object instead
of as its own attribute. My footer (which i want to always be at the bottom
of the page)
winds up scrunched as close to the top of the page as possible (base on
current cotent of
the table). So how do i tell the new XHTML that i want my table to stretch
itself to the full
height of the document?

Also, what is the proper way to align the table in the center of the page. I
personally cannot
stand when a web page hangs off to the left side of the screen, so i would
always put on my
main table an ALIGN=CENTER, so that it would be in the middle of the page.
But this is
gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
instead but it had
no effect.

Also, does it _functionaly_ make a difference whether the style definition
is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?

Thanks in advance,
- Arthur Dent.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
Tools|Options|TextEditor|HTML|Validation is where you can turn this off.

You should be aware, though, that the reason this is used is because XHTML
will eventually supercede HTML on the WWW. This is a good thing. HTML has
become increasingly complex and unpredictable across many browsers. The
formatting rules for it are not strict enough, and it is not easily
extensible. XML in general, and XHTML specifically, are much more
extensible than HTML. XML follows some very strict but simple formatting
rules. For example, elements can not overlap. Opening tags must always be
followed by closing tags. Attributes must always be quoted. These things
will eventually cause all browsers to render content in the same way. But
some things you are now doing may not work correctly in browsers in the
future. Learning the XHTML standard, or at least the transitional
standard, will prevent a lot of future headaches for you, though they may
cause you a few in the short run (learning them, that is).

XHTML relies on styles almost exclusively, rather than attributes. This is
also a good thing. Putting CSS styles into an external style sheet, or at
least in a style sheet in the <head> of the document separates the layout
presentation rules from the HTML objects themselves, which makes it much
easier to change the way your documents look. Inline attributes (and
inline CSS styles) "lock" the appearance into the structure of the object,
making it difficult to find, identify, and change the way the elements
look and behave. The use of external CSS style sheets also allows you to
use the same style sheet for many documents, which is also a very good
thing.

Many attributes are already deprecated. The "height" attribute has not
been a part of the standard since at least HTML 3.2, and I'm not sure if
it ever was. The "width" attribute of a table has been recently
deprecated. All of this is heading towards the use of CSS for this type of
thing.

So, I gave you the means to turn it off, and a few reasons not to. Now the
ball is in your court!

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:eL**************@TK2MSFTNGP14.phx.gbl...
Hello all, ive been programming with ASP.NET since it came out, but am
just getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered with
2.

I use tables to layout my pages, doing three rows, a header, content and
footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.

With 2.0/2005 though, when it renders the pages, it doesnt actually
render at 100% height (even though the code is in the ViewSource of the
page).
the table only goes as high as the content forces it, as if the height
were not set at all.

Ive traced it to this line put in by the designer:

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

Is there a way to turn this off, so the designer doesnt put this line
out, so that my tables will render properly? I tried using the Insert
Table wizard, and specifying the height of 100% but it the same problem
as manually coding it.

Oh, also, it tells me the "align" attribute is obsolete on the table tag,
and i should use the newer construct, but it doesnt tell me what that
is... what is considered the "right" way to align a table in the center
of the page now?

Thanks in advance,
Arthur Dent


Dec 21 '05 #3
Hi Arthur,

As to height, you can use the CSS height style, which can be one of 2
alternative types:

nnnPX;
nnn%;

For center alignment, it's a little less intuitive. You use both margin-left
and margin-right, as in:

margin-left:auto;
margin-right:auto;
Also, does it _functionaly_ make a difference whether the style definition
is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?
Not functionally, no. However, here are the advantages of each:

inline: None. Almost as bad as attributes.
document style sheet: Styles may be used throughout the document. Less text,
less redundancy, less points for you to make a mistake and forget or omit
something. Easier to change the style of the document, as the style sheet is
easy to find.
external style sheet: All the advantages of a document style sheet, but you
can also use the same styles for multiple pages.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl... Okay, i understand all that, and it makes sense. And given that i would
agree it would be
better to find the "new & improved" way of styling my tags as opposed to
turning off the
validation tag.
I still have some questions then though about the specific styles of
HEIGHT and ALIGN.

HEIGHT does not seem to do anything even when i put it in the style of the
object instead
of as its own attribute. My footer (which i want to always be at the
bottom of the page)
winds up scrunched as close to the top of the page as possible (base on
current cotent of
the table). So how do i tell the new XHTML that i want my table to stretch
itself to the full
height of the document?

Also, what is the proper way to align the table in the center of the page.
I personally cannot
stand when a web page hangs off to the left side of the screen, so i would
always put on my
main table an ALIGN=CENTER, so that it would be in the middle of the page.
But this is
gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
instead but it had
no effect.

Also, does it _functionaly_ make a difference whether the style definition
is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?

Thanks in advance,
- Arthur Dent.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
Tools|Options|TextEditor|HTML|Validation is where you can turn this off.

You should be aware, though, that the reason this is used is because
XHTML will eventually supercede HTML on the WWW. This is a good thing.
HTML has become increasingly complex and unpredictable across many
browsers. The formatting rules for it are not strict enough, and it is
not easily extensible. XML in general, and XHTML specifically, are much
more extensible than HTML. XML follows some very strict but simple
formatting rules. For example, elements can not overlap. Opening tags
must always be followed by closing tags. Attributes must always be
quoted. These things will eventually cause all browsers to render content
in the same way. But some things you are now doing may not work correctly
in browsers in the future. Learning the XHTML standard, or at least the
transitional standard, will prevent a lot of future headaches for you,
though they may cause you a few in the short run (learning them, that
is).

XHTML relies on styles almost exclusively, rather than attributes. This
is also a good thing. Putting CSS styles into an external style sheet, or
at least in a style sheet in the <head> of the document separates the
layout presentation rules from the HTML objects themselves, which makes
it much easier to change the way your documents look. Inline attributes
(and inline CSS styles) "lock" the appearance into the structure of the
object, making it difficult to find, identify, and change the way the
elements look and behave. The use of external CSS style sheets also
allows you to use the same style sheet for many documents, which is also
a very good thing.

Many attributes are already deprecated. The "height" attribute has not
been a part of the standard since at least HTML 3.2, and I'm not sure if
it ever was. The "width" attribute of a table has been recently
deprecated. All of this is heading towards the use of CSS for this type
of thing.

So, I gave you the means to turn it off, and a few reasons not to. Now
the ball is in your court!

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:eL**************@TK2MSFTNGP14.phx.gbl...
Hello all, ive been programming with ASP.NET since it came out, but am
just getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered
with 2.

I use tables to layout my pages, doing three rows, a header, content and
footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.

With 2.0/2005 though, when it renders the pages, it doesnt actually
render at 100% height (even though the code is in the ViewSource of the
page).
the table only goes as high as the content forces it, as if the height
were not set at all.

Ive traced it to this line put in by the designer:

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

Is there a way to turn this off, so the designer doesnt put this line
out, so that my tables will render properly? I tried using the Insert
Table wizard, and specifying the height of 100% but it the same problem
as manually coding it.

Oh, also, it tells me the "align" attribute is obsolete on the table
tag, and i should use the newer construct, but it doesnt tell me what
that is... what is considered the "right" way to align a table in the
center of the page now?

Thanks in advance,
Arthur Dent



Dec 21 '05 #4
Thanks for the info.... that center alignment DEFinitely, like you said, is
not intuitive. But it did
work perfectly.

I still cannot get the height to work properly though. With the validation
line in the HTML source,
the rendering completely ignores the HEIGHT specification on my table,
whether i do it as a style
attribute, a document style tag, or through a css class. But if i take out
the validation line, then the
height renders completely perfectly as expected.
The problem then though is, if i take out that validation like, then the
margin-[left|right]:auto to do
center alignment no longer works.

How do you get the HEIGHT of a table set at 100% to *actually* render as
100% height in the
new XHTML world???

Thanks in advance,
- Arthur Dent.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Arthur,

As to height, you can use the CSS height style, which can be one of 2
alternative types:

nnnPX;
nnn%;

For center alignment, it's a little less intuitive. You use both
margin-left and margin-right, as in:

margin-left:auto;
margin-right:auto;
Also, does it _functionaly_ make a difference whether the style
definition is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?


Not functionally, no. However, here are the advantages of each:

inline: None. Almost as bad as attributes.
document style sheet: Styles may be used throughout the document. Less
text, less redundancy, less points for you to make a mistake and forget or
omit something. Easier to change the style of the document, as the style
sheet is easy to find.
external style sheet: All the advantages of a document style sheet, but
you can also use the same styles for multiple pages.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Okay, i understand all that, and it makes sense. And given that i would
agree it would be
better to find the "new & improved" way of styling my tags as opposed to
turning off the
validation tag.
I still have some questions then though about the specific styles of
HEIGHT and ALIGN.

HEIGHT does not seem to do anything even when i put it in the style of
the object instead
of as its own attribute. My footer (which i want to always be at the
bottom of the page)
winds up scrunched as close to the top of the page as possible (base on
current cotent of
the table). So how do i tell the new XHTML that i want my table to
stretch itself to the full
height of the document?

Also, what is the proper way to align the table in the center of the
page. I personally cannot
stand when a web page hangs off to the left side of the screen, so i
would always put on my
main table an ALIGN=CENTER, so that it would be in the middle of the
page. But this is
gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
instead but it had
no effect.

Also, does it _functionaly_ make a difference whether the style
definition is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?

Thanks in advance,
- Arthur Dent.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
Tools|Options|TextEditor|HTML|Validation is where you can turn this off.

You should be aware, though, that the reason this is used is because
XHTML will eventually supercede HTML on the WWW. This is a good thing.
HTML has become increasingly complex and unpredictable across many
browsers. The formatting rules for it are not strict enough, and it is
not easily extensible. XML in general, and XHTML specifically, are much
more extensible than HTML. XML follows some very strict but simple
formatting rules. For example, elements can not overlap. Opening tags
must always be followed by closing tags. Attributes must always be
quoted. These things will eventually cause all browsers to render
content in the same way. But some things you are now doing may not work
correctly in browsers in the future. Learning the XHTML standard, or at
least the transitional standard, will prevent a lot of future headaches
for you, though they may cause you a few in the short run (learning
them, that is).

XHTML relies on styles almost exclusively, rather than attributes. This
is also a good thing. Putting CSS styles into an external style sheet,
or at least in a style sheet in the <head> of the document separates the
layout presentation rules from the HTML objects themselves, which makes
it much easier to change the way your documents look. Inline attributes
(and inline CSS styles) "lock" the appearance into the structure of the
object, making it difficult to find, identify, and change the way the
elements look and behave. The use of external CSS style sheets also
allows you to use the same style sheet for many documents, which is also
a very good thing.

Many attributes are already deprecated. The "height" attribute has not
been a part of the standard since at least HTML 3.2, and I'm not sure if
it ever was. The "width" attribute of a table has been recently
deprecated. All of this is heading towards the use of CSS for this type
of thing.

So, I gave you the means to turn it off, and a few reasons not to. Now
the ball is in your court!

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:eL**************@TK2MSFTNGP14.phx.gbl...
Hello all, ive been programming with ASP.NET since it came out, but am
just getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered
with 2.

I use tables to layout my pages, doing three rows, a header, content
and footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.

With 2.0/2005 though, when it renders the pages, it doesnt actually
render at 100% height (even though the code is in the ViewSource of the
page).
the table only goes as high as the content forces it, as if the height
were not set at all.

Ive traced it to this line put in by the designer:

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

Is there a way to turn this off, so the designer doesnt put this line
out, so that my tables will render properly? I tried using the Insert
Table wizard, and specifying the height of 100% but it the same problem
as manually coding it.

Oh, also, it tells me the "align" attribute is obsolete on the table
tag, and i should use the newer construct, but it doesnt tell me what
that is... what is considered the "right" way to align a table in the
center of the page now?

Thanks in advance,
Arthur Dent



Dec 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Fuli Chang | last post by:
I don't like other people see my html code. Is there a way to hide it? Thanks.
8
by: Seth | last post by:
How can I completely turn off the auto formatting of Html in Visual Studio 7? I have tried all possible combinations (at least I think I have) of the Tools / Options / Text Editor / HTML XML /...
258
by: Terry Andersen | last post by:
If I have: struct one_{ unsigned int one_1; unsigned short one_2; unsigned short one_3; }; struct two_{ unsigned int two_1;
1
by: coder10 | last post by:
Two things 1. Why does ASP.Net not respect code formatting for the HTML tags. I mean, when I write my HTML, I try to use appropriate tabs and spaces and lines beween my tags, but when I save and...
10
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim...
3
by: realmerl | last post by:
Hi All. I'm trying to transform a html document into plain text via xslt. Simple you say! (i hope) I have got it working, by using the magnificent <xsl:value-of select="."/>. This returns the...
3
sanjay123456
by: sanjay123456 | last post by:
Dear friends, <?php //define the receiver of the email $to = 'sanjay.mit@gmail.com'; //define the subject of the email $subject = 'Test HTML email'; //create a boundary string. It must be...
5
by: Surbhi | last post by:
Hi We have HTML datasheets but now we want then in PDF format because page layout is very bad when HTML is printed. I am through with the XML and XSLT part. But donot hav any idea of XSL- FO....
3
by: CJM | last post by:
David, Thanks for the reply. Responses inline: "David E. Ross" <nobody@nowhere.notwrote in message news:OZadnaBdOMGpYb3VnZ2dnUVZ_vOdnZ2d@softcom.net... This is a promotional mailshot so...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.