16 replies [Last post]
bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

Is it possible to set the background color of the whole page (excluding boxes and such) inside of an external style sheet? How would I do that without having it wash out the whole page and boxes, ect? I seem to be having that problem.

Also, I'm having a problem w/ images.

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<div class="raised">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">
<h1>The UA</h1>
<p><img src="logo.jpg"></p>
</div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>

My image is in the same folder as the stylesheet and this index page, yet the image isn't appearing. Is this a CSS thing?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

setting bgcolor in external, plus img problems

Of course it's possible, you would set a background color or image on the html, body{background: #000;} elements but bearing in mind that the default background of elements is transparent so that your background would initially block out all elements, if you had a layout which had a wrapper or container div that was a first child of the body and that enclosed your layout (which is good practise) then you would set that wrapper to have a background of say white, now your layout is set off against the body background color.

You don't really supply much information to your image problem but give the image element it's height and width attributes.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

http://www3.uakron.edu/lgbtu/indextest.html

the image is not showing up in my box.

code:

<body bgcolor="orange">

<link rel="stylesheet" type="text/css" href="stylesheet.css">


<div class="raised">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">
<h1>The UA</h1>
<p><img src="http://www3.uakron.edu/lgbtu/sitelogo.gif" width="100%" height="100%"></p>
</div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>

<div class="body">
Here is the disclaimer, yes?

what is going on?

Anonymous
Anonymous's picture
Guru

setting bgcolor in external, plus img problems

What color are my socks?

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

white? what does that have to do with anything?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

setting bgcolor in external, plus img problems

Dark blue.

BXFL as to whats going on my physic abilities tell me that you may have a corrupted image file.

Have you ruled out all the obvious possible reasons such as a file actually existing, the path to the file actually pointing to the right directory, what actions have you taken to track down this error ?.

Having looked at your code sadly I see that you are quite new to writing pages there are a lot of fundamental errors and I would strongly urge you to read up on a few very basic beginners tutorials on HTML and CSS . We are more than happy to help people but they must get a grasp of some of the fundementals of web page construction.

I do hope that this is not what the University of Akron teaches, the page living at /lgbtu/ is also chock full of very bad errors. I hope that this is not indicative of the standards taught there.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

No, it is not what it teaches. I am doing this on my own, sorry to offend you with my terrible coding abilities.

And I suppose I've just now seen that my image is corrupted. Sorry.

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

well, now that i made sure my file is not corrupt, do you have any suggestions as to what may be causing the image not to appear?

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 year 12 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

setting bgcolor in external, plus img problems

Quote:
The image “http://www3.uakron.edu/lgbtu/sitelogo.jpg” cannot be displayed, because it contains errors.
I cannot confirm the image is error free.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

I'm not understanding what is causing the image to have errors. Whenever I view the image itself on the server, it seems to be fine. I even switched the format from JPEG to GIF and still when I load indextest.html i get nothing. Any idea why this is happening?

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 year 12 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

setting bgcolor in external, plus img problems

The error message I quoted was from an attempt to access directly.

When you say you can view it directly, is that on your local machine? It occurred to me that you might have uploaded the file as ascii rather than binary. I've done that often enough, more than often enough.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

setting bgcolor in external, plus img problems

I'm not offended by your code, I'm not that precious Smile

But foresee other problems along the way.

My veiled remark about corrupted image file was indeed in reference to an attempt to access the image directly sorry I should have been clearer.

Gary's view that it may be a a problem with uploading as ASCII rather than binary seems a likely reason and I believe that it is quite easy for this to happen unintentionally although this has never happened to me Smile and am surprised to hear that Gary could make a mistake of this nature Smile

Do let us know if this was indeed the problem.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 year 12 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

setting bgcolor in external, plus img problems

Baron Munchausen wrote:
… although this has never happened to me …

:sigh:

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

setting bgcolor in external, plus img problems

Sorry bxfl I didn't notice your post stating you had confirmed that the image wasn't corrupted, but see that it's working now. What was the problem then ?

Oh ok Gary, I've made the error once or twice, ok ok quite a few times.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

The image is not showing up in the indextest.html I made, in a box. I will take a look and see if I uploaded it wrong. I was viewing it from my machine when I last confirmed it. I am now viewing the image directly from a different machine and it still seems to load. It will only not load within the indextest.html
and I don't know why Sad

bxfl
Offline
Regular
Last seen: 16 years 50 weeks ago
Joined: 2005-06-09
Posts: 11
Points: 0

setting bgcolor in external, plus img problems

Nevermind! I just had to add a doctype to it -hides- :oops: Thank you everyone for your help, sorry for the trouble I caused!

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

setting bgcolor in external, plus img problems

Ah, the old DTD trick I suppose there's nothing like a concrete example of the reasons to use one rather than have us bleat on about it's use so I guess from now on you'll include one, it will also help in switching browsers into 'Standards Mode' where they will follow the CSS specs more completely.

All's well that ends well. Smile

Hugo.

P.S you caused no trouble, but you should pursue a few tutorials and gain a little more knowledge in writing valid X/HTML and CSS you'll find a fair bit of help in the 'How To' section to get you started and were always here to answer questions.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me