PC Review


Reply
Thread Tools Rate Thread

css and master page problem

 
 
laziers@gmail.com
Guest
Posts: n/a
 
      5th Jan 2008
Hi,
I have a "little" problem. I'v got a very simple page:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
#form1{background-color: blue}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
text
</div>
</form>
</body>
</html>

I run it, and everything is ok [the text in form is blue], BUT! when I
create a masterpage:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" 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>Untitled Page</title>
<style type="text/css">
#form1{background-color: blue}
</style>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
text
<asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

the text isn't blue now. What should I do to have a blue text?
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      5th Jan 2008
<(E-Mail Removed)> wrote in message
news:fe0b2e78-e29d-4c47-a0e3-(E-Mail Removed)...

> What should I do to have a blue text?


Avoid using object names in your style... If you do a View Source on your
page, you'll see that you don't have a "form1" any more...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
laziers@gmail.com
Guest
Posts: n/a
 
      5th Jan 2008

> Avoid using object names in your style... If you do a View Source on your
> page, you'll see that you don't have a "form1" any more...


I see, but look at this:

form1 is in the: default.aspx page, ale form2 is in the: default2.aspx
I want blue text in form1 and red in form2,

the style: form {background-color: blue} will not work good.

?
 
Reply With Quote
 
Naraendirakumar R.R.
Guest
Posts: n/a
 
      6th Jan 2008
Hi.
We had to acommodate a similar design. We ended up introducing <div> as the
only child of the form tag, to solve this problem. We applied the style to
the <div> tag.

Cheers,
-Naraen

<(E-Mail Removed)> wrote in message
news:bfcc4b79-aa75-4738-999b-(E-Mail Removed)...
>
>> Avoid using object names in your style... If you do a View Source on your
>> page, you'll see that you don't have a "form1" any more...

>
> I see, but look at this:
>
> form1 is in the: default.aspx page, ale form2 is in the: default2.aspx
> I want blue text in form1 and red in form2,
>
> the style: form {background-color: blue} will not work good.
>
> ?



 
Reply With Quote
 
laziers@gmail.com
Guest
Posts: n/a
 
      6th Jan 2008
On 6 Sty, 20:09, "Naraendirakumar R.R." <nos...@nospam.com> wrote:
> Hi.
> We had to acommodate a similar design. We ended up introducing <div> as the
> only child of the form tag, to solve this problem. We applied the style to
> the <div> tag.
>


yes, with dives works fine, thanks

cheers
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Master page problem xlar54 Microsoft C# .NET 4 18th Aug 2008 06:38 PM
Problem with web page containing Updatepanel & Script manager while including master page Valli Microsoft ASP .NET 1 3rd Oct 2007 10:31 PM
Master page problem Pitaridis Aristotelis Microsoft ASP .NET 0 27th Jul 2006 06:49 AM
Master Page problem Code Monkey Microsoft C# .NET 2 29th Jun 2006 04:54 PM
master page problem Support Microsoft ASP .NET 1 9th Dec 2005 09:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:04 AM.