The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> CSS line height confusion
johnminkough
post Feb 28 2012, 04:21 PM
Post #1


Newbie
*

Group: Members
Posts: 17
Joined: 6-December 11
Member No.: 16,008



Hi

I'm struggling to understand CSS, with mixed results.

For example, on this page:

http://johnminkoff.com/resumestatement2012.html

...there is extra space under the headings "Teaching" and "Collections"

If I hit delete after one of these headings, the heading and the text below it become part of the same line. Then if I hit return I go back to having too much space. I can
achieve no middle ground.

Nothing I do with the linked CSS file seems to change this.

The other resume sections currently have no extra space between heading and text, but if I start messing with them, I
get the same result as seen on "Teaching" and "Collections" and can only eliminate the extra space with an undo.


Here is the linked CSS file:

p {
font-family: Courier New, Courier, monospace;
line-height:normal
font-size:12px;
}

body {
font-family: Courier New, Courier, monospace;
line-height:normal
font-size:12px}

td {
font-family: Courier New, Courier, monospace;
line-height:normal
font-size:12px
}

th {
font-family: Courier New, Courier, monospace;
line-height:normal
font-size:12px}.footer {
position: relative;
right: 10px;
}.disclaimer{font-size:15px}
.name {
font-style: normal;
font-weight: bold;
}
.disclaimer2 {
font-size: 12px;}
.grey {
color: #999;
}.arrow{
position:relative;
top:19px;
}
.thing{line-height:normal}

Any help would be great.

Thanks.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Feb 28 2012, 04:42 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 7,857
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



The online tools report markup and CSS errors, including some related to your line-height properties:
http://htmlhelp.com/cgi-bin/validate.cgi?u...mp;warnings=yes
http://jigsaw.w3.org/css-validator/validat...ng=&lang=en


--------------------
Darin McGrew
WDG Member since 1998
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 28 2012, 05:34 PM
Post #3


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 13,733
Joined: 9-August 06
Member No.: 6



The markup is different for almost every section. That's why they display differently.

The text following "Teaching" is in a P. The same goes for "Collections" but there the heading itself is also in a P. "Education" on the other hand uses no Ps at all.

Most block level elements are given margins by the browsers. That's why Ps display as paragraphs even if there is no author style sheet involved. There can be both top and bottom margins, that depends on the browser.

Use the element that's appropriate for the text, but style it to look as you want. Add margins, remove margins... In this case the headings should be marked up as headings, with H(n), and the lines that follow them could maybe be seen as a list.


--------------------
“Never go to excess, but let moderation be your guide.”
– Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
johnminkough
post Feb 28 2012, 05:48 PM
Post #4


Newbie
*

Group: Members
Posts: 17
Joined: 6-December 11
Member No.: 16,008



OK, thanks.

Probably the main lesson here is that applying css
to my hodgepodge know-nothing html coding of several years
ago is going to raise problems.

I'll probably just start over on the resume section at some point, or at least
do a major overhaul.

If I understand correctly, my problem is one of margins, not line height. Good to know.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
johnminkough
post Feb 28 2012, 06:19 PM
Post #5


Newbie
*

Group: Members
Posts: 17
Joined: 6-December 11
Member No.: 16,008



Gotta say that those jigsaw results aren't making much sense, though.

I'm supposed to add a semicolon BEFORE THE PROPERTY NAME? Doesn't that go after the value?

This post has been edited by johnminkough: Feb 28 2012, 06:21 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 28 2012, 06:42 PM
Post #6


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 13,733
Joined: 9-August 06
Member No.: 6



I agree it could have been expressed better. If they had flagged 'font-size' and said the same thing it would make more sense.

I often find the CSS checker a little odd this way, or maybe it's just because I think the WDG HTML validator is perfect. wub.gif With the CSS checker it isn't always clear to me where the error actually occurs until I find it in the style sheet. For a person that doesn't know CSS very well yet that can be really, really confusing.


--------------------
“Never go to excess, but let moderation be your guide.”
– Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 28 2012, 06:44 PM
Post #7


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 13,733
Joined: 9-August 06
Member No.: 6



And yes, the semicolon goes where you say it does.


--------------------
“Never go to excess, but let moderation be your guide.”
– Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 29 2012, 09:43 AM
Post #8


.
********

Group: WDG Moderators
Posts: 4,776
Joined: 10-August 06
Member No.: 7



QUOTE(johnminkough @ Feb 29 2012, 12:19 AM) *

I'm supposed to add a semicolon BEFORE THE PROPERTY NAME? Doesn't that go after the value?

That's actually the same thing(*). Or more correctly, it should go in between. When a property value is followed by another property name, separate them with a semicolon. Line-breaks don't matter though, so the following rules are equal:

CODE
html {foo: 1; bar: 2; baz: 3;}


CODE
html {
foo: 1;
bar: 2;
baz: 3;
}


CODE
html {
foo: 1
;bar: 2
;baz: 3;
}


(*) The exceptions are before the first property name and after the last property's value, where you don't need a semicolon --I always add one anyway, for good measure.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
johnminkough
post Feb 29 2012, 10:54 AM
Post #9


Newbie
*

Group: Members
Posts: 17
Joined: 6-December 11
Member No.: 16,008



Right it's usually the same thing, but to phrase it as "semicolon before the property" is to create confusion.

The jigsaw results were also strange because there were in fact semicolons following the preceding value/before the property in
question. It missed them.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Feb 29 2012, 12:08 PM
Post #10


Programming Fanatic
********

Group: Members
Posts: 3,547
Joined: 23-August 06
From: Europe
Member No.: 9



But neither line-height properties have a semicolon at the end of their values.

As a side note, the name of your CSS file is inaccurate now that the declared font is Courier.


--------------------
"The earth does not belong to us. We belong to the earth."
from Vue du ciel (in French)

"Leave scepticism to others and take action"
from HOME by Goodplanet

An inconvenient truth by Al Gore
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 29 2012, 07:58 PM
Post #11


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 13,733
Joined: 9-August 06
Member No.: 6



It isn't the same thing when it's related to a specific declaration and property name - as it actually is in the validator result. It's easy to think it refers to the property name that is flagged. It should say "before the NEXT property name".


--------------------
“Never go to excess, but let moderation be your guide.”
– Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th May 2013 - 07:13 PM