Am 23.04.2010 17:05, schrieb Charles Liu:
> Hello,
> I am trying to build a web and am a CSS newbie.  What I want to accomplish is 
> to have different background images for other pages. I have been trying to 
> insert embedded style sheet between<style></style>  from local page to 
> override the default image. But can't make it work.
>
>
>
> <default.css>
>
>
>
> #logo {
>
>              width: 960px;
>
>              height: 286px;
>
>              margin: 0 auto;
>
>              background: url(../images/home.gif) no-repeat left top;
>
> }
>
>
>
> I try to override the background image as follows:
>
>
>
> <head>
>
> <link href="css/default.css" rel="stylesheet" type="text/css" media="screen" 
> />
>
> <style type="text/css" title="default" media="all">
>
>                          #logo {
>
>                          background: url(../images/newimg.gif) no-repeat left 
> top;
>
> }
>
> </style>
>
> </head>
>
>
>
> The browser removes the default image but does not show the new image. Where 
> did I do wrong? Can anyone help? Or is there a better way to achieve that?
>
> Thanks,
>
> Charles
>
>
> ______________________________________________________________________
> css-discuss [[email protected]]
> http://www.css-discuss.org/mailman/listinfo/css-d
> List wiki/FAQ -- http://css-discuss.incutio.com/
> List policies -- http://css-discuss.org/policies.html
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
>    

The css file's location is
css/default.css
so the path/root for any relative image url in the css is
css/

The mage url in that css file is
../images/home.gif

together, that results in
css/../images/home.gif

or
images/home.gif

For the style rules embedded in the html file the relative root is the 
location of the document being
.

The mage url in the rule is
../images/newimg.gif

together, that results in
./../images/newimg.gif

Is that a valid path in your webserver's configuration? I guess you just 
have to change the image url in the ruleembedded in the html file to 
simply "images/newimg.gif"

Best regards

Christian
*Editura GmbH & Co. KG*
Tempelhofer Damm 2 · 12101 Berlin
www.editura.de
AG Berlin-Charlottenburg · HRA 43189 B · USt.Id. DE217180548
Geschäftsführer: Ralf Szymanski

______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to