| Author |
Message |
Desbrina Jadeite

Joined: 11 Jun 2005 Posts: 2958 Location: Earth
|
Posted: Wed Nov 21, 2007 5:15 am Post subject: background image and colour |
|
|
Is there a way to get it so that if images dont load, then it shows a background colour
I tired using both colour an image, but it didn't work
| Code: | background: url(images/background.png);
background:#000000; |
The reason i'm asking is when i'm at college, i have images disabled, and because i used white text, i have to highlight the text in order to read it
Is there a way to do this _________________ Midnight Tempest - A Sailor Moon TCG
Balanced Force - A Star Wars TCG |
|
| Back to top |
|
| |
nagisa_01 Novice Poster
Joined: 15 Sep 2007 Posts: 14 Location: Montevideo - Uruguay
|
Posted: Wed Nov 21, 2007 9:15 am Post subject: |
|
|
Well you are using the short notation of the background set of rules, i think it should have worked the way you wrote it, but you could try either to write the rule in the short notation or rule by rule, that would be the correct use of the css rule.
It would be as follow:
| Code: | | background: #000 url(images/background.png); /*#000 is a short version of #000000 */ |
Or rule by rule:
| Code: | background-image: url(images/background.png);
background-color: #000; |
|
|
| Back to top |
|
| |
ClickFanatic Est. 2005

Joined: 18 Jan 2005 Posts: 3857
|
Posted: Wed Nov 21, 2007 9:23 am Post subject: |
|
|
The background image is placed 'on top' of the background color.
If the background image is not available, then the background color (if specified) will be visible.
You can use the rules posted by nagisa_01. Note the difference in how the shorthand and the separate rules work. _________________ Captain Jell-O Buster from the Future
[img]http://feeds.feedburner.com/sparepencil.1.gif[/img] |
|
| Back to top |
|
| |
Desbrina Jadeite

Joined: 11 Jun 2005 Posts: 2958 Location: Earth
|
|
| Back to top |
|
| |
Desbrina Jadeite

Joined: 11 Jun 2005 Posts: 2958 Location: Earth
|
Posted: Wed Nov 21, 2007 4:47 pm Post subject: |
|
|
ok, i found a problem with adding both in, for the background image i'm using a transparent png
If i have images enabled, then the png isn't showing the body image
is there a way round this?
I know i can add transparencies to the actual divs, but then the text etc inside of the appears transparent _________________ Midnight Tempest - A Sailor Moon TCG
Balanced Force - A Star Wars TCG |
|
| Back to top |
|
| |
ClickFanatic Est. 2005

Joined: 18 Jan 2005 Posts: 3857
|
|
| Back to top |
|
| |
Desbrina Jadeite

Joined: 11 Jun 2005 Posts: 2958 Location: Earth
|
Posted: Wed Nov 21, 2007 5:10 pm Post subject: |
|
|
i'll try my best explaining it
When at home, i have images enabled, but at college they are disabled
Because the background image for the content and navigation divs is an 80% transparent dark grey png, with white text, when the images are disabled, i get white text on a white background, which i have to highlight to read
This is an image of what i want the page to be like when images are enabled
http://i5.photobucket.com/albu.....a/img3.png
as you can see from the image, the content and navigation are slightly transparent, letting the stars from the body background image show through
using the code nagisa_01 posted above, the page appears fine when images are disabled
http://i5.photobucket.com/albu.....a/img1.png
but the problem is when images are enabled
http://i5.photobucket.com/albu.....a/img2.png
As you can see from the image, there is no transparency in the content and navigation boxes
I hope I've explained it better _________________ Midnight Tempest - A Sailor Moon TCG
Balanced Force - A Star Wars TCG |
|
| Back to top |
|
| |
ClickFanatic Est. 2005

Joined: 18 Jan 2005 Posts: 3857
|
Posted: Wed Nov 21, 2007 5:27 pm Post subject: |
|
|
I see what you mean now. The problem is due to the fact that the image is placed above the background color. So the transparency is applied to a solid color... which means the background does indeed not show through.
There is not a perfect way to solve it, but I have an idea that might be a good alternative.
Create a background image for the content boxes with the starfield under a semi-transparent layer. In Photoshop or a similar layer based editor you can do this as follows: Open the starfield image. Open the PNG overlay image. Create a new layer on the starfield images. Copy the PNG overlay to the new layer and stretch to fit (or simply create a solid fill and change the layer transparency).
You will use this 'fake transparency' image as a background for the boxes. Due to the randomness of the starfield, you probably won't notice a 'break' in the background pattern. _________________ Captain Jell-O Buster from the Future
[img]http://feeds.feedburner.com/sparepencil.1.gif[/img] |
|
| Back to top |
|
| |
Desbrina Jadeite

Joined: 11 Jun 2005 Posts: 2958 Location: Earth
|
|
| Back to top |
|
| |
|
|
|