Learning CSS
Starting following tutorials but this one starts talking about tables?
http://www.w3schools.com/css/css_table.asp
Being called W3Schools i thought it would be up to date... i thought tables were a big no no?
Any other good websites there on how to do a website layout in CSS?
Cheers
-Rob
robfenn posted this at 11:54 — 20th September 2007.
He has: 471 posts
Joined: Jun 2005
Just found this great thing called Google that has helped me...
So i've started turning a design i did yesterday into CSS.
Table Version:
http://www.sixthsense-esp.co.uk/needmotorsport/1.htm
CSS Version:
http://www.sixthsense-esp.co.uk/CSS/NeedMotorsport.htm
I'm going to have a lot of questions, but my first is, why is there a page margin still? It is set to 0 in the stylesheet
http://www.sixthsense-esp.co.uk/CSS/NeedMotorsport.css
Megan posted this at 13:18 — 20th September 2007.
She has: 11,421 posts
Joined: Jun 1999
You left off the semi-colon on the background colour. Add that and it'll read the margin.
Good luck! Those W3schools tutorials are a little outdated sometimes - they probably wrote them years ago. There are also a lot of sample layouts out there that you can try.
Megan
Connect with us on Facebook!
robfenn posted this at 13:39 — 20th September 2007.
He has: 471 posts
Joined: Jun 2005
Thanks Megan
Ok, so the next problem!
I'm not sure the best way of doing the menu, but i set the background rectangles as a background image within the div. I have then adjusted the line spacing of the text to fit the background image... but it seems that each line spacing is actually a bit less?
http://www.sixthsense-esp.co.uk/CSS/needmotorsport.htm
Any suggestion on fixing this, or a better way of doing the menu?
Thanks!
webseller2002 posted this at 00:12 — 21st September 2007.
She has: 8 posts
Joined: Sep 2007
I think tables are ok in certain situations and even though CSS and CSS2 are now the "thing" there are still tons of sites that use a tabled design.
Megan posted this at 13:05 — 21st September 2007.
She has: 11,421 posts
Joined: Jun 1999
No, no, no. I'm not going to argue about that, but NO! CSS is not just a trend, it's here to stay.
Those dark blue backgrounds are background images? You probably don't need that. Put a lot of padding on the a and then put the background colour on it. Then use margins to put spacing between the items.
That menu should be a list, not paragraphs. Make it a list then take all the margins and padding off the ul.
Megan
Connect with us on Facebook!
dk01 posted this at 20:24 — 21st September 2007.
He has: 516 posts
Joined: Mar 2002
The number of sites using CSS is increasing and it is very common on newly designed sites. Sure older sites may still use CSS, but that usually is because it could be costly or too time consuming to change. That doesn't mean new designers shouldn't still try and learn CSS techniques. Good luck Rob!
-dk
robfenn posted this at 08:05 — 21st September 2007.
He has: 471 posts
Joined: Jun 2005
True, could i argue then for the menu i would be using a table for tabular data?
robfenn posted this at 10:50 — 24th September 2007.
He has: 471 posts
Joined: Jun 2005
Thanks for the well wishings
Megan, i've followed your advice...
http://www.sixthsense-esp.co.uk/CSS/needmotorsport2.htm
I guess the trouble is making the padding equal for all menu items. The only way i can think of doing it is each menu item has a style with different padding attributes to line them up equally?
Sorry for my continuous questions!
dk01 posted this at 14:39 — 24th September 2007.
He has: 516 posts
Joined: Mar 2002
Rod,
Try changing this line in your CSS file:
p.menu a:link {color: #E1F1FB; text-decoration: none; padding: 0.2cm; background: #44A5E2;}
'to this:
p.menu a:link {color: #E1F1FB; text-decoration: none; padding: 0.2cm; background: #44A5E2; display:block; margin: auto 0 auto auto; width:100px;}
'This does the following:
I hope that helps!
-dk
robfenn posted this at 15:52 — 24th September 2007.
He has: 471 posts
Joined: Jun 2005
Brilliant, thanks DK! Can i change the margin to affect the height of the padding there, as they are a little thick?
http://www.sixthsense-esp.co.uk/CSS/needmotorsport2.htm
Also, how can i bunch up the menu items a little so they resemble the old design? The menu doesn't line up at the top with the picture either
http://www.sixthsense-esp.co.uk/needmotorsport/1.htm
Lastly (i know, im annoying), in IE the menu panel doesn't go down the whole page, yet it is set to 100% Anything i can do here?
dk01 posted this at 00:17 — 25th September 2007.
He has: 516 posts
Joined: Mar 2002
Rob,
Glad I could help. The pages look identical in IE and Firefox now and they look identical to your old version in both browsers. I'm guessing you either found answers to your questions and made the changes or are seeing something different than I am. I am using Firefox 2.0.0.7 and IE 7.0.5730.11
If you are still seeing problems you might try taking a screenshot and posting that.
-dk
robfenn posted this at 08:18 — 25th September 2007.
He has: 471 posts
Joined: Jun 2005
Hi DK,
Shows how much i use IE, i hadn't upgraded it here at work! That solves the top alignment and the 100% height issue (although still concerned about it not working in IE6, i thought it was quite a basic thing!).
The biggest problem still remains though, and is worse in IE7 than Firefox. Here are screenshots of the spacing difference.
IE7 CSS Menu:
IE7 Tables Menu:
Renegade posted this at 09:58 — 26th September 2007.
He has: 3,022 posts
Joined: Oct 2002
Why don't you try this:
#navigation p {
margin-top:0;
margin-bottom:0;
}
I think your problem may be that since you're using paragraphs for each one of your menu items, each browser has different margin set. If you tried setting the margin (or padding) so it's the same across all browsers, it might solve your problem.
robfenn posted this at 11:51 — 26th September 2007.
He has: 471 posts
Joined: Jun 2005
Thanks for that bit of code, i've used it to narrow the gap so it's spot on!
The only thing left is adjusting the height of the menu background blocks to be less...
I believe this is the code:
block; margin: auto 0 auto auto; --- what bit do i change?!
Also, i've noticed the menu doesn't line up with the picture in Firefox...grr!
JennyScoth0109 posted this at 07:47 — 31st October 2007.
They have: 29 posts
Joined: Oct 2007
I just got my CSS lessons in this page:
http://www.w3.org/Style/CSS/learning
'because w3 is an updated one and of course... valid
Ontario Mortgage
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.