Positioning with 2.0

G

Guest

I just installed VS 2005. Was working with 2003 and .Net 1.1. Trying to get the feel for a master page and I'm having some issues. I'm looking for a pretty basic setup. Standard header with an image, forced to lower right of screen, in the content area. I had this working just fine in 1.1, but the tags seem to behave quite differently in 2.0.

If I remove the !DOCTYPE element, I get what I want. Is it dangerous to remove this? How can I acheive the effect I want using proper 2.0 stuff? Here's some code:


<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">
<title>Welcome To...</title>
</head>
<body style="background-color: #006b58;">
<form id="form1" runat="server">
<div>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; height: 100%;">
<tr>
<td>

<table cellpadding="0" cellspacing="0" border="0" style="width: 100%;">
<tr>
<td nowrap style="width: 800px; height: 60px; background-image: url(images/image1.jpg);"></td>
<td style="width: 100%; background-image: url(images/image1a.jpg);"></td>
</tr>
</table>

</td>
</tr>
<tr valign="top" style="height: 100%; background-position: right bottom; background-image: url(images/image2.jpg); background-repeat: no-repeat;">
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
</td>
</tr>
</table>
<div>
</form>
</body>

</html>


With the !DOCTYPE declaration in place, the second row of the table won't hold it's 100% height assignment. If I pull it, it's perfect.

Also, VS is complaining that the "nowrap" attribute is outdated and that I should use a newer contruct. Where can I find out what the appropriate newer construct is? If I leave out the "nowrap" then I end up losing the image all together.

Thanks.

Jerry
 
D

Daniel Fisher\(lennybacon\)

You shoult use <div>-layers instead of tables



http://www.codeproject.com/aspnet/aspnetsinglesignon.asp



Daniel Fisher(lennybacon) | Software Engineer | newtelligenceR AG
blog: <http://staff.newtelligence.net/danielf/>
staff.newtelligence.net/danielf | usergroup:
<http://www.vfl-niederrhein.net> vfl-niederrhein.net

_____

From: (e-mail address removed) [mailto:[email protected]]
Posted At: Thursday, February 23, 2006 1:41 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Positioning with 2.0
Subject: Positioning with 2.0


I just installed VS 2005. Was working with 2003 and .Net 1.1. Trying
to get the feel for a master page and I'm having some issues. I'm
looking for a pretty basic setup. Standard header with an image, forced
to lower right of screen, in the content area. I had this working just
fine in 1.1, but the tags seem to behave quite differently in 2.0.



If I remove the !DOCTYPE element, I get what I want. Is it dangerous to
remove this? How can I acheive the effect I want using proper 2.0
stuff? Here's some code:





<%@ Master Language="VB" CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >



<head runat="server">

<title>Welcome To...</title>

</head>

<body style="background-color: #006b58;">

<form id="form1" runat="server">

<div>

<table cellpadding="0" cellspacing="0" border="0" style="width:
100%; height: 100%;">

<tr>

<td>



<table cellpadding="0" cellspacing="0" border="0"
style="width: 100%;">

<tr>

<td nowrap style="width: 800px; height: 60px;
background-image: url(images/image1.jpg);"></td>

<td style="width: 100%; background-image:
url(images/image1a.jpg);"></td>

</tr>

</table>



</td>

</tr>

<tr valign="top" style="height: 100%; background-position: right
bottom; background-image: url(images/image2.jpg); background-repeat:
no-repeat;">

<td>

<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server"></asp:ContentPlaceHolder>

</td>

</tr>

</table>

<div>

</form>

</body>



</html>





With the !DOCTYPE declaration in place, the second row of the table
won't hold it's 100% height assignment. If I pull it, it's perfect.



Also, VS is complaining that the "nowrap" attribute is outdated and that
I should use a newer contruct. Where can I find out what the
appropriate newer construct is? If I leave out the "nowrap" then I end
up losing the image all together.



Thanks.



Jerry
 
G

Guest

Well, okay... But that doesn't go very far towards answering my questions...
You shoult use <div>-layers instead of tables



http://www.codeproject.com/aspnet/aspnetsinglesignon.asp



Daniel Fisher(lennybacon) | Software Engineer | newtelligence® AG
blog: staff.newtelligence.net/danielf | usergroup: vfl-niederrhein.net


------------------------------------------------------------------------------

From: (e-mail address removed) [mailto:[email protected]]
Posted At: Thursday, February 23, 2006 1:41 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Positioning with 2.0
Subject: Positioning with 2.0


I just installed VS 2005. Was working with 2003 and .Net 1.1. Trying to get the feel for a master page and I'm having some issues. I'm looking for a pretty basic setup. Standard header with an image, forced to lower right of screen, in the content area. I had this working just fine in 1.1, but the tags seem to behave quite differently in 2.0.



If I remove the !DOCTYPE element, I get what I want. Is it dangerous to remove this? How can I acheive the effect I want using proper 2.0 stuff? Here's some code:





<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >



<head runat="server">

<title>Welcome To...</title>

</head>

<body style="background-color: #006b58;">

<form id="form1" runat="server">

<div>

<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; height: 100%;">

<tr>

<td>



<table cellpadding="0" cellspacing="0" border="0" style="width: 100%;">

<tr>

<td nowrap style="width: 800px; height: 60px; background-image: url(images/image1.jpg);"></td>

<td style="width: 100%; background-image: url(images/image1a.jpg);"></td>

</tr>

</table>



</td>

</tr>

<tr valign="top" style="height: 100%; background-position: right bottom; background-image: url(images/image2.jpg); background-repeat: no-repeat;">

<td>

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>

</td>

</tr>

</table>

<div>

</form>

</body>



</html>





With the !DOCTYPE declaration in place, the second row of the table won't hold it's 100% height assignment. If I pull it, it's perfect.



Also, VS is complaining that the "nowrap" attribute is outdated and that I should use a newer contruct. Where can I find out what the appropriate newer construct is? If I leave out the "nowrap" then I end up losing the image all together.



Thanks.



Jerry
 
S

Steven Cheng[MSFT]

Hi rlrcstr,

Does the difference you mentioned occur at design-time only in the VS 2005
ide's designview of the page? I think the output of the page at runtime
still should be correct. And for VS IDE it does change the design-time view
of the page because of this can make our manipulation on the page element
more convenient. e.g when two nested table have set the same width and
height, if the design view doesn't display some gap between the table's
borders, it'll be very difficult to choose either of them through mouse in
design-view.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
A

Alan Silver

If I remove the !DOCTYPE element, I get what I want.  Is it dangerous
to remove this?

Depends what you mean by dangerous. As you have seen, there may be
differences in the way a browser renders a page, depending on the
doctype. This is somewhat bogus as the doctype should not be used for
this purpose, but it is, so you have to live with it.

Removing the doctype probably put your browser into Quirks mode, whereby
it emulates old (buggy) implementations. This is not a good idea. You
should be aiming for 100% valid XHTML and CSS.
  How can I acheive the effect I want using proper 2.0 stuff?

First read up on XHTML and CSS and learn to code it properly. Make
liberal use of the validators to make sure your code is valid. If you
stick to that, you should find that your pages will look fine in any
browser, and even degrade gracefully in older ones.

HTH
 
G

Guest

Thanks for the reply, Alan...

Actually, my code validates just fine using the XHTML validator, just that
the behavior is different with and without the DOCTYPE specification. But I
can't seem to figure out how to force a table row to take up the remaining
height of the screen when the DOCTYPE spec is there. using a style that
includes "height: 100%" works without the spec, but with the spec the height
collapses to the cell content height.

Is there some new way to specify this in XHTML? Thanks.

Jerry
 
A

Alan Silver

Thanks for the reply, Alan...

Actually, my code validates just fine using the XHTML validator, just that
the behavior is different with and without the DOCTYPE specification.

Yup, that's because some browsers (incorrectly) use the doctype (or lack
of) to decide which mode to use for rendering. Due to bugs in Netscape 4
and IE5, a lot of pages were written with a faulty box model rendering
in mind. Later browsers fixed that particular area of bugs, leaving a
lot of existing page now broken. Browser vendrs decided to have two
rendering modes, standards and quirks, with the latter being for
backwards compatibility for pages written with the bugs in mind.

For more on this, as well as a comprehensive list of what doctypes
trigger what rendering modes, see http://hsivonen.iki.fi/doctype/
But I
can't seem to figure out how to force a table row to take up the remaining
height of the screen when the DOCTYPE spec is there. using a style that
includes "height: 100%" works without the spec, but with the spec the height
collapses to the cell content height.

First, you can't *force* anything with browsers, you can only suggest.
They are largely free to ignore your suggestions!!
Is there some new way to specify this in XHTML? Thanks.

I don't think so. I think this was actually not valid even in HTML4, but
I could be wrong. You would be better asking this in an HTML or CSS
newsgroup, as you'll get a more definitive answer.

Try news:comp.infosystems.www.authoring.html and
news:comp.infosystems.www.authoring.stylesheets for more advice.

HTH
 
Joined
Oct 5, 2006
Messages
2
Reaction score
0
The CSS for nowrap="nowrap" is white-space: nowrap. For example:
<td style="white-space: nowrap;">
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top