We help IT Professionals succeed at work.

Div Tag not using/recognizing CSS rule in Stylesheet - ASP.NET 2.0

bensarz asked
Last Modified: 2012-05-05
Hey guys,

I'm having a really hard time understanding the error, if I could just understand what is going on... that would help me a lot in fixing the problem...


I have a masterpage.master that loads up for page movies.aspx
here's the code from the master page:

<%@ 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>Page sans titre</title>
<link href="App_Themes/Default/StyleSheet.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
    <div id="Header" style="background-image:url(images/sub_01.jpg); height:209px; margin-left:auto; margin-right:auto; width:789px;"></div>
    <div id="Nav" style="height:27px; margin-left:auto; margin-right:auto; width:789px;">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="789" height="27">
            <param name="movie" value="Nav.swf" />
            <param name="quality" value="high" />
            <embed src="Nav.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" width="789" height="27"></embed>
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">

The movies.aspx page is suppose to use the theme called "Default" and a style sheet in the "Default" theme folder called DefaultStyleSheet.css.

Here's the CSS code:

    background-image: url(images/sub_body_background.jpg);
    background-repeat: repeat-y;

super simple up to here...
now here's the code of the movies.aspx file:
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Movies.aspx.vb" Inherits="Movies" title="Movies" Theme="Default" StylesheetTheme="Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="ContentDiv">

my problem is that the #ContentDiv is not using the background image from the css rule "background-image: url(images/sub_body_background.jpg);"
however it is using the other rules (margins, height and width)
I have verified everything.... if I put this rule in the "style" attribute of the div tag it works...
but I want to use the same ccs rule in many pages (links.aspx, bio.aspx, etc...) thus why I want this to work with the style sheet...

any idea!?!?
Watch Question

Top Expert 2007
This one is on us!
(Get your first solution completely free - no credit card required)
is it a pathing thing?

are the master page, and other pages in the same folder?

if not, might want to play with that, see if something like
background-image: url(../images/sub_body_background.jpg);
or variations of might work
Top Expert 2007

:) i reckon i was just a few seconds before
sometimes you win, sometimes you lose, I've had it both ways...


you know...  I tried everything!!!
I even played with the paths.... *sigh* should have caught this one...

Thanks guys!!!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.