CSS query - noob trying to learn

dod

dod

Soldato
Joined
31 Oct 2002
Posts
4,122
Location
Inverness
Right, I'm determined to do as you guys say and I'm going to learn CSS, because from what I've read on here and the various links posted I can actually see the potential benefits. Given that I don't really know HTML it's probably going to be a bit of a steep learning curve but who knows :D Apologies for this being SO basic, wouldn't surprise me if some of you just laughed but you've got to start somewhere :o (I've bought one of those SAMS Teach yourself books)

First problem, why won't the h1 text in the attached screen shot show up at the correct height? I can get the border to change, alignment, font etc but not the size. Help a 40 something old fogey guys :p

Css file
/* CSS Document */

h1 {font:Verdana, Arial, Helvetica, sans-serif;
color: blue;
border-width:thick;
border-color:#00FF33;
background-color:#FFCC66;
border-style:groove;

text-align: center;
font-size: 75;
}

h2 {font:"Amerika Sans";
color:#FF3333;
border-color:#009900;
border-width:medium;
border-style: outset;
font-size:14px;
}
and screenie
csstest.jpg
 
Last edited:
You've mentioned font-size: 75;, but what units are you measuring in? Is that 75 people, cakes or elephants?

I believe the units you have to choose from for this purpose are px and em, although the usability crowd usually recommend the use of relative font sizing using - you guessed it - percentages.

av. :)
 
Doh, public humiliation :o Thanks for pointing it out :)

When you say relative sizing, relative to what? I'm only on page 10 ;)
 
|Ric| said:
p.s. you might want to check "font" I think it should be font-family, try w3schools for basic CSS examples
font is shorthand, and allows you to declare all the font information (family, size, weight etc.) in a single line. Apparently font is more widely supported than the "longhand" alternative - which seems strange, but there you go. Roger Johansson over at 456 Berea Street has an excellent article on CSS shorthand

There may be other benefits which I've overlooked, but from my perspective shorthand is easier to write and can shave quite a bit off your CSS file sizes. One or two kilobytes may not seem like a lot, but if you run a big website with lots of visitors the bandwidth savings soon add up :)
 
mmh thats one new thing learnt today :)

It still isn't valid CSS, he cannot ommit the font size :)
And then he uses font and font-size for h2

In the end my point is kinda valid, but indeed I was wrong

Ric.
 
thanks for the help and info guys. :)

Page 24 is getting confusing, class, ID and descendant selectors :confused:
 
dod said:
thanks for the help and info guys. :)

Page 24 is getting confusing, class, ID and descendant selectors :confused:
And there are quite a few more selectors than just those three simple ones, but they're rarely used due to IE's serious lack of support for them (until IE7 takes hold anyway).

http://css.maxdesign.com.au/selectutorial/ should be helpful to explain the concepts behind selectors. They're a fundamental part of CSS and so it's really worth investing the time on getting to grips with the different types available, even if in practice you can't always use them :).
 
Back
Top Bottom