PDA

View Full Version : html/css trouble


HollyThirtyFive
13-05-2008, 22:42
Hi,

I've started teaching myself html/css and have struck a problem! I wanted to create an orange background with white content background in the middle.
However like the jpeg shows the border up until the body main div. (i may be talking gobbledy gook lol I've only been learning a week!)
http://i13.photobucket.com/albums/a300/hsellors/Picture2.jpg
(there is text in the black boxes but i've blocked it for now as its only draft ramblings!)

My codes are:
css:
http://i13.photobucket.com/albums/a300/hsellors/Picture3-1.png

html:
http://i13.photobucket.com/albums/a300/hsellors/html.jpg

I want to make the borders go all the way to the bottom of the page. But can't figure out what needs changing!

Help very much appreciated :o:confused::)

HollyThirtyFive
13-05-2008, 22:53
Also this is my original mock up made on PS before I even attempted Dreamweaver so its very rough, but gives some idea of what I want :-)
http://i13.photobucket.com/albums/a300/hsellors/webmock.jpg

Mark
13-05-2008, 23:02
Had a bit of bother reading your code because it's so small, but got there in the end.

I can't remember if the background-color attribute applies to the margins of a div. I suspect it probably does. The easiest solution I can come up with (though not necessarily the most "correct" one) is to specify a border for the wrapper div, and specify a colour as well.

Start with something like:

border: 10px solid #FF6600;

and adjust from there.

Another option is to use two divs, one inside the other. Specify a smaller width for the inner one and put the background colour there.

PS - I'm personally not particularly keen on fixed width divs (even though I used them on my own site). They assume a particular monitor resolution which your viewer may not have. If you have to use them - and you often do, then I believe the current best option is to go for something that'll fit on 1024x768.

iCraig
14-05-2008, 00:34
How wide (in pixels) is your header? Header being the white box containing the logo and menu etc.

Apply that width to your "Main" DIV.

HollyThirtyFive
14-05-2008, 08:22
When I changed the width of the main to 1200 px which is the length of the header. This happened:
http://i13.photobucket.com/albums/a300/hsellors/Picture5.png

hmm :confused:

Thanks for the help!

Mark
14-05-2008, 08:50
Changing the width of the "main" div won't help you, because it's the "wrapper" div that's causing the problem with the background. In fact, the "main" div has to be less than 930px wide - otherwise it'll float below the picture on the right as you've found out.

You can either try the border suggestion from my post, or this:

Add another div - call it "content" (or somesuch). Make it 1100px wide. Move the background-color setting from the "wrapper" div to this new div. In the HTML code, add this new div so that is contains both the existing "photo" and "main" divs, but not the "header" div. I'm not sure whether or not it'll need to contain the "navigation" div as well - experiment. :)

iCraig
14-05-2008, 10:27
Ah, didn't spot the wrapper DIV. Mark's second solution is what I'd try.

HollyThirtyFive
15-05-2008, 08:20
I tried them both but when I tried marks second suggestion the whole background went orange hmm so I think I will start again from scratch incase there is a tiny error somewhere. I'm following a book about design and the website in there has a similar border to what I'm aiming for except when I did it nothing happened lol

Davey_Pitch
15-05-2008, 08:54
Any chance you could post up the html and css files? If I could play around with them I'm sure I could get it working. :)

HollyThirtyFive
15-05-2008, 13:09
That would be cool :-) thanks! I'll do it when I get home later!

I've gone and got myself confused now by editing things and cant get it back to the orignal image :o

But if you can fiddle around with it that will be great! :)

Davey_Pitch
15-05-2008, 14:18
Is this kinda what you were after Holly, a simple border surrounding a white area you could put images and text into? Obviously it would be central, this was a 2 minute knock up to see if it's what you wanted.

http://img366.imageshack.us/img366/4765/exampleql7.th.jpg (http://img366.imageshack.us/my.php?image=exampleql7.jpg)

HollyThirtyFive
15-05-2008, 18:13
Yeah, I would like an orange border around it :-)

Here is my css code as it stands:
@charset "UTF-8";
/* CSS Document */


body {
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
margin:0px;
padding:0px;}

h1 {margin:0;}

h1, h2, h3, h4 {color:#000000; font-weight:bold; text-transform:capitalize; font-size:12px;}



#header {
padding-left:125px;
padding-right:25px;
padding-bottom:0px;
}

#navigation li {
display: inline;
font-size:14px;
font-weight:bold;
}

#photo {
float:right;
width:278px;
}

#main {
padding-left: 20px;
padding-right: 20px;
float: left;
width:550px;
}

#wrapper {
width: 1200px;
margin:auto;
background-color:#FFFFFF;

}

a:link {color:#000000;}
a:visited {color:#FF3300;}
a:hover {color:#FF3300;}

And my html code:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<title>Project Lumino</title>
<link href="bio.css" rel="style sheet" type="text/css"/>
</head>

<body>

<div id="header">
<h1><img src="headerlarge.jpg" alt="Project Lumino Site"/></h1>
</div>

<div id="navigation">
<ul>
<li>Home</li>
<li>Bio</li>
<li>News</li>
<li>Gallery</li>
<li>Music</li>
<li>Blog</li>
<li>Merch</li>
<li>Links</li>
</ul>
</div>


<div id="photo">
<img src="biomeimage.jpg"/>
</div>


<div id="main">
<h2>Biography</h2>
<h3>The Beginning</h3>

<p>Project Lumino is me, Holly Sellors. I creating electronic music in April 2007. My inspiration for producing began when I studied Music Technology.</p>

<p>textextextextextextextexttextextextextextextextext textextextextextextextexttextextextextextextextext textextextextextextextexttextextextextextextextext textextextextextextextext</p>

<h4> The start of Lumino</h4>

<p>textextextextextextextexttextextextextextextextext textextextextextextextexttextextextextextextextxte xt</p>

<p>textextextextextextextexttextextextextextextextext textextextextextexteextextextextextextexttextextex textextextextexttextextextextextextextext</p>

<p>textextextextextextextexttextextextextextextextext textextextextextextextexttextextextextextexttextte xtextextextextextextext</p>

</div>

</body>
</html>

</xsl:template>
</xsl:stylesheet>

:-)

Mark
15-05-2008, 18:32
I can't get the files to display in a browser. I'm not sure if the forum has corrupted them or what.

Are the actual files downloadable from somewhere?

I can see what needs changing but I don't want to start working on files that are corrupt in the first place.

Thanks.

HollyThirtyFive
15-05-2008, 20:57
Here are the 2 image files I use:
http://i13.photobucket.com/albums/a300/hsellors/headerlarge.jpg

http://i13.photobucket.com/albums/a300/hsellors/biomeimage.jpg
:)

Mark
15-05-2008, 21:07
Thanks but no problem with those - it's the HTML/CSS that are causing the problem.

HollyThirtyFive
15-05-2008, 21:54
Oh, I'm not sure what you mean? Do you mean they don't work when you copy and paste them?

Mark
15-05-2008, 22:02
Unfortunately true. Do you have them on a website somewhere? If not, do you still use MSN (you're showing offline right now)?

Davey_Pitch
15-05-2008, 22:26
Is this kinda what you wanted?

http://img170.imageshack.us/img170/9025/hollyexampleyu4.th.jpg (http://img170.imageshack.us/my.php?image=hollyexampleyu4.jpg)

Mark
15-05-2008, 23:07
OK Davey, I'll leave it to you as you seem to be having much more success with it than I am. :dunno:

HollyThirtyFive
16-05-2008, 09:15
I wanted it so the left and right borders touch the ends of the logo image, which is what I couldnt manage to do. I think it was 125px originally to make the width of the borders touch the sides. Does that make sense? lol

Sorry am at work so cant go into too much detail!

Davey_Pitch
16-05-2008, 09:57
Yeah, I think I know what you mean, should be easy enough to sort out :)

Davey_Pitch
16-05-2008, 14:04
This?

http://img229.imageshack.us/img229/6472/newexamplepz2.th.jpg (http://img229.imageshack.us/my.php?image=newexamplepz2.jpg)

HollyThirtyFive
17-05-2008, 14:46
That's perfect :-) thank you so much!! How does the the code work out?

Davey_Pitch
17-05-2008, 20:09
HTML code


<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Project Lumino</title>
<link href="bio.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
<div id="header">
<h1><img src="headerlarge.jpg" alt="Project Lumino Site"/></h1>
</div>
<div id="navigation">
<ul>
<li>Home</li>
<li>Bio</li>
<li>News</li>
<li>Gallery</li>
<li>Music</li>
<li>Blog</li>
<li>Merch</li>
<li>Links</li>
</ul>
</div>
<div id="photo">
<img src="biomeimage.jpg"/>
</div>
<div id="main">
<h2>Biography</h2>
<h3>The Beginning</h3>
<p>Project Lumino is me, Holly Sellors. I creating electronic music in April 2007. My inspiration for producing began when I studied Music Technology.</p>
<p>textextextextextextextexttextextextextextextext exttextextextextextextextexttextextextextextextext exttextextextextextextextexttextextextextextextext exttextextextextextextextext</p>
<h4> The start of Lumino</h4>
<p>textextextextextextextexttextextextextextextext exttextextextextextextextexttextextextextextextext xtext</p>
<p>textextextextextextextexttextextextextextextext exttextextextextextexteextextextextextextexttextex textextextextextexttextextextextextextextext</p>
<p>textextextextextextextexttextextextextextextext exttextextextextextextextexttextextextextextexttex ttextextextextextextextext</p>
</div>
</div>
</body>
</html>


CSS code


@charset "utf-8";
/* CSS Document */


body {
background-color:orange;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
margin:0px;
padding: 0px 20px 20px 20px
}

#wrapper
{
background-color:#FFFFFF;
min-height:800px;
width:800px;
margin:auto;
}

#navigation li {
display: inline;
font-size:14px;
font-weight:bold;
}

#photo {
float:right;
width:278px;
}


If you have any problems with it just let me know :)

HollyThirtyFive
18-05-2008, 12:09
Right I've discovered my problem I think I did have. I tried out that code and the layout worked fine, except again the orange background didn't show and the header came out too big, the verdana didn't show up either.

Downloaded Firefox though, as I was previously using Safari to preview and apart from the header being too big (which is easily changed) everything else works :)

It makes me worry though, if it always works in Firefox ok, but nothing comes up in Safari, what happens when I've finished it and it doesn't work in Safari :confused:

Is there anyway of assuring it will work in Safari?

HollyThirtyFive
18-05-2008, 12:34
hmm tried resizing the header image to make it fit correctly within the borders. Only the Alt text now shows up in Mozilla. Still nothing shows in Safari.
In Mozilla:
http://i13.photobucket.com/albums/a300/hsellors/Picture10.png
In Safari:
http://i13.photobucket.com/albums/a300/hsellors/Picture11.png

:(

Thanks Davey, I can't understand what's different in mine to yours, and why it cant recognise the new image even though it's saved as a jpg with the correct link.

I think my professional dream career as a web designer is a looooooong way off lol

Mark
18-05-2008, 13:17
For the background, try changing the background-color from orange to #ffa500 (or use #ff7800 to match the orange colour in the header). Also, try removing the header (h1) tags from around the header image. Other than that I can't help much without knowing what you changed with the header.

Davey_Pitch
18-05-2008, 17:18
This is what I see in Safari, using my code. If you're seeing different, I'm wondering if Macs render things differently to Windows....

http://img230.imageshack.us/img230/4703/example2bk0.th.jpg (http://img230.imageshack.us/my.php?image=example2bk0.jpg)

leowyatt
18-05-2008, 17:41
Davey you got that code live as I'll check it on my iBook here to see how it renders?

Davey_Pitch
18-05-2008, 18:01
Fraid not Leo, it's only local at the moment and I don't have any webspace I can upload it to.

Mark
18-05-2008, 19:45
Davey's code as posted with no changes (link will be taken down Monday night or sooner if requested):

http://www.ouroboros.me.uk/tmp/bio.html

Tested on - IE6, IE7, FF2, FF3, Safari - all working.

HollyThirtyFive
19-05-2008, 08:20
Thank you :-) I have saved the code and will try it when I get back tomorrow night. Sorry for being a pain!

Davey_Pitch
21-05-2008, 10:57
How did it look in the end Holly? :)

HollyThirtyFive
21-05-2008, 13:44
I need to try it tonight, I've been busy the last two nights untill late. I will try some tonight. I hope it works! I can't see any reason why it won't and I can't wait to get it finished.

Will let you know later :)

HollyThirtyFive
21-05-2008, 22:41
I've just opened up new documents as now I understand more I can take all the code in better. For now I have just put in a header 1 with the header image and then a navigation list. I've linked up the html and css files ok.

The same problem is happening again. I preview it in Safari and the header jpeg shows, but the list stays vertical. If I open it in Mozilla the Jpg doesn't show but the list does show horizontally in-line.

I'm using Dreamweaver 8 if that makes any difference? I don't get it!

Mark
21-05-2008, 23:07
Might do. Hardcore types like me just dump the code into a text editor. Dreamweaver is generally pretty well behaved but you never know.

Also, there might be some oddities with opening the files locally vs. uploading them (I didn't try it locally on my Mac).

Davey_Pitch
22-05-2008, 00:10
Holly, can you post up your edited files so I can see whether I'm getting the same problem now you've edited the files. There may be some little quirk going on with something you've changed.

HollyThirtyFive
26-05-2008, 00:12
DW seems to be working ok now. I've fiddled about a bit more and found an easier lay out. But there is still a browser problem. I've been told not to trust the DW preview so much. But it all goes to pot in browsers!

This is how it looks in Dw:
http://i13.photobucket.com/albums/a300/hsellors/Picture4.png

This is how it looks in Safari:
None of the CSS for the font has picked up. It is in default Times New Roman. The "album" div to the right side has moved out of place. The orange background no longer shows up.
http://i13.photobucket.com/albums/a300/hsellors/Picture5-1.png

This is how it looks in Mozilla:
The header image doesn't show. The album Div is misplaced. However the orange background and font style show fine.
http://i13.photobucket.com/albums/a300/hsellors/Picture6.png


<!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>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Welcome to Project Lumino</title>
<link href="210508.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="wrapper">

<div id="header">
<h1><img src="headerlarge.jpg" alt="Project Lumino Site" width="834" height="107"/></h1>
</div>

<div id="navigation">

<ul>

<li>Home </li>
<li>Biography </li>
<li>Gallery</li>
<li>Music</li>
<li> Merchandise </li>
<li>Links</li>

</ul>

</div>

<div id="main">
<h1> </h1>
<h1>News</h1>
<p><strong><u>18.03.08</u></strong>
<p>textextextetxtetxtetxtetextextextextextextextextte xtextextetxtetxtetxtetextex
extextextextextexttextextextetxtetxtetxtetextextex textextextextexttextextextetxt
txtetxtetextextextextextextextexttextextextetxtetx tetxtetextextextextextextextex
</p>
<p>textextextetxtetxtetxtetextextextextextextextextte xtextextetxtetxtetxtetextex
extextextextextexttextextextetxtetxtetxtetextextex textextextextexttextextextetxt
txtetxtetextextextextextextextexttextextextetxtetx tetxtetextextextextextextextex
textextextetxtetxtetxtetextextextextextextextext</p>



</div>
<p>textextextetxtetxtetxtetextextextextextextextextte xtextextetxtetxtetxtetextex
extextextextextexttextextextetxtetxtetxtetextextex textextextextexttextextextetxt
txtetxtetextextextextextextextext.<br />
</p>
<p>Hope all is well and give me any feedback you can on my new song!!!</p>
<hr />
<p><u><strong>06.01.08</strong></u></p>
<p>I am now hand making the "Waking Up" album. Each cd cover will be made personally by myself for each order and they will all be unique. The cd's will be limited and will stop when the limited number is reached.</p>
<p>Two extra bonus tracks are included: <br />
- Dont React ft Peppi Knott<br />
- Early Days (re mixed & mastered) </p>
<p>To pay for it all you need is a Paypal account and submit £10 to the email address: buywakingup@hotmail.co.uk. The page should look like this:</p>
<p>Main Page> Send Money></p>
<p>To: buywakingup@hotmail.co.uk<br />
Amount: 10<br />
Currency: GBP British Pounds<br />
Usage: Gift›</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>
<p>

</div>

<div id="album">
<img src="../PL FINAL COVER.jpg" alt="Waking Up" width="176" height="180"/>
<h2>Debut Album - Waking Up</h2>
<p>If you would like to listen to my album it is available to purchase from:</p>
<li>iTunes</li>
<li>Amazon mp3</li>
<p>To order a special hand-made album you will need a Paypal account. </p>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>

</div>
</body>
</html>

</div>


Here is the CSS
/* CSS Document */

@charset "utf-8";
/* CSS Document */

body {
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
background-color:#FF9933;
margin-left:250px;
margin-right:250px;
margin-top:0px;
margin-bottom:0px;
padding:0px;
}

h1, h2, h3, h4 {color:#000000; font-weight:bold; text-transform:capitalize; font-size:12px;}
h1 {
margin:0px;
font-size:18px;
}
h2 {
margin:0px;
}

#wrapper {
width:750px;
margin:auto;
background-color:#FFFFFF;}

#header {
padding-left:0px;
padding-right:0px;
padding-bottom:0px;
padding-top:0px;
}


#navigation li {
display:inline;
font-size:14px;
}

#main {
background-color:#FFFFFF;
float: left;
margin:0px;
width:657px;
}

#album {
float:right;
margin:0px;
width:175px;
background-color:#FFFFFF;
}

Mark
26-05-2008, 01:18
OK - three problems I've spotted.

There's an extra </div> in the middle of the news section. I can't find any matching division for that so guess it should be removed.
The </div> right at the end needs to be moved above </body>
The 'main' and 'album' divs don't fit inside 'wrapper'. The 'wrapper' div is defined as 750px, but 'main' (657px) plus 'album' (175px) makes 832px. This is the cause of the album section falling to the bottom. I'm guessing by the width of the header bitmap you need to make the wrapper 834px. It may also be a good idea to reduce the width of main to about 630px.
That only leaves the background colour of 'wrapper'. I can't spot the reason why that isn't working in Firefox (works in IE) but hopefully someone else will.

One final suggestion. In the CSS for 'body', I'd recommend removing the left and right margins. Personal preference but I think it'll work better for more people.

HollyThirtyFive
26-05-2008, 09:53
Thank you for the help :)

The random div at the bottom must've been a typo whilst copying as its not on my DW doc.
However changing the margin width makes it a lot tidier and working in the browsers. Mozilla now is almost perfect except it's not showing the header.jpeg but shows the album.jpeg fine. Maybe that's an error with the file?

Safari everything is showing, the layout is perfect but the font style is still default times new roman.

HollyThirtyFive
30-05-2008, 13:06
Right now everything including the css is perfect in Safari and how I'd want it if I were to put the site online. Mozilla is the same but the header image still won't show. I can't work it out?

Does putting an img src in a header div need to be in any particular place?

I put the site through the w3c validation and that really really made a difference!!

Mark
30-05-2008, 13:16
Right click (or Mac equivalent) on the 'Project Lumino Site' bit (i.e. where the header should be) and see if there's a 'View image' option. If there is, click it. What happens?

HollyThirtyFive
01-06-2008, 00:55
Right I've had a complete change of look on the site now as I wasn't 100% with the orange. I re did a new header and have made a side bar bit. With the new header it is now working in Safari and in Mozilla!!
What do you think?
http://i13.photobucket.com/albums/a300/hsellors/Picture1-2.png

Mark
01-06-2008, 01:55
I'm with you on the orange. Definitely prefer the new choice.

A little (hopefully) constructive criticism. I'm not entirely sure about the header as it looks like it takes up quite a lot of space and quite a lot of that is empty. Please bear in mind a lot of people can't or don't want to run as high a resolution as you or I - indeed I can only do it because I have a 27in monitor. One other suggestion would be to add a margin between the blue page border and the text - especially on the right as it's looking a little squashed there.

Hope this helps.

HollyThirtyFive
05-06-2008, 23:28
Bought the webspace last night and the very basic version of the site is now up at
http://www.projectlumino.co.uk

:-) needs a lot of work doing. Iv ripped out plenty of hairs understanding uploading to ftp. But finally I can sleep peacefully :-)