Forum Moderators: not2easy

Message Too Old, No Replies

image locations within classes

         

Befuddled53

10:48 am on Sep 3, 2023 (gmt 0)



Could somebody please explain the syntax for defining an image location with a class definition. In this case, the image (yellow.jpg) is to be used as part of a background. I have tried:
.myclass { background:url(../images/site/BookBackgrounds/yellow.jpg) top right no-repeat) }
but no luck. Thank you.

not2easy

12:45 pm on Sep 3, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



To position the image rather than the .myclass container, we use background-image and define the properties specific to that image and not the .myclass element:
 .myclass
{
background-image: url(../images/site/BookBackgrounds/yellow.jpg);
background-repeat: no-repeat;
background-position: top right;
}

Befuddled53

1:08 pm on Sep 3, 2023 (gmt 0)



Thank you. I will try that, but I've just posted to my previous thread connected to this one in that the class itself is not being referenced. I thought it was the image url which was wrong, but it's the class itself which is invisible for some reason.