By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,835 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

remove formatting for certain objects

P: n/a
Gang,

I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects). I am running into an issue using ul's. I will give you the
code below:

<ul class="liCol1">
<li>Vendor name</li>
<li>Address</li>
<li>City St, Zip</li>
<li>Phone number</li>
<li class="liSpacer">&nbsp;</li>
<li>Data directory</li>
<li>Temp directory</li>
<li class="liSpacer">&nbsp;</li>
<li>DSA keys</li>
</ul>

and here is the css from an external file:

..ulCol1 {
list-style: none;
text-decoration: none;
margin: 0px;
padding: 0px;
}

..liCol1 li {
margin: 4 0 0 0;
height: 17px;
}

..liSpacer {
margin: 0px;
padding: 0px;
height: 12px;
font-size: 10px;
}

This works just fine for the li's that have text in them. The ones
that have the class="liSpacer" don't seem to use css that is given.
Why would this not take effect? Is there a way that I can stop
inheritence from the ".liCol1 li" section? Any help would greatly be
appreciated.

Also note, that there may be several of these on a page so I was
trying to avoid giving each ul an id.

Feb 1 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
In article
<11*********************@p10g2000cwp.googlegroups. com>,
he******@yahoo.com wrote:
Gang,

I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects). I am running into an issue using ul's. I will give you the
code below:

<ul
that have the class="liSpacer" don't seem to use css that is given.
Why would this not take effect? Is there a way that I can stop
inheritence from the ".liCol1 li" section? Any help would greatly be
appreciated.

Also note, that there may be several of these on a page so I was
trying to avoid giving each ul an id.
You could look at simply classing some of the <li>s - either at
the top or bottom of the junctures wanted - and assign bigger
bottom or top margins. There is an example of this sort of thing
at:

<http://sn2.com.au>

--
dorayme
Feb 1 '07 #2

P: n/a
On 2007-02-01, he******@yahoo.com <he******@yahoo.comwrote:
Gang,

I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects). I am running into an issue using ul's. I will give you the
code below:
[snip]
.liCol1 li {
margin: 4 0 0 0;
height: 17px;
}

.liSpacer {
margin: 0px;
padding: 0px;
height: 12px;
font-size: 10px;
}

This works just fine for the li's that have text in them. The ones
that have the class="liSpacer" don't seem to use css that is given.
It looks like .liCol1 li is more "specific" than .liSpacer. See CSS 2.1
6.4.3.
Why would this not take effect?
If you make ".liSpacer" ".liCol1 li.liSpacer" instead, it will become
more specific (two classes and one element beats one class and one
element).
Is there a way that I can stop inheritence from the ".liCol1 li"
section? Any help would greatly be appreciated.
Not that I know of. You can give all the non-spacer <li>s their own
class and then you can select them with a selector that won't match the
spacers as well. Otherwise override everthing you set in .liCol1 li in
..liCol1 li.liSpacer to set it back to the default.
Feb 1 '07 #3

P: n/a
Scripsit he******@yahoo.com:
I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects).
Whether you use modern programming is immaterial. CSS is not programming,
though you can write programs that generate, read, modify, or interpret CSS
code.

There is nothing wrong with using tables when you have tabular data. Whether
an address is tabular data is debatable, but the fact is that there are
authors who are "getting aways from using tables" in vain, even making their
pages less logical and more difficult to maintain.
I am running into an issue using ul's.
When you have run into an issue with CSS, it's virtually always a waste of
everyone's time to post a question without revealing the URL.
I will give you the code below:
You are not giving yourself good chances of getting the help you need.
<ul class="liCol1">
<li>Vendor name</li>
<li>Address</li>
<li>City St, Zip</li>
<li>Phone number</li>
<li class="liSpacer">&nbsp;</li>
<li>Data directory</li>
<li>Temp directory</li>
<li class="liSpacer">&nbsp;</li>
<li>DSA keys</li>
</ul>
What's "liCol1"? Class names should be descriptive of meaning and structure,
not cryptic codes for intended formatting.

Why the spacer items? Use vertical margins instead.
and here is the css from an external file:

.ulCol1 {
list-style: none;
text-decoration: none;
margin: 0px;
padding: 0px;
}
Why do you present this snippet? There is no class "ulCOl1" in your markup
snippet.
.liCol1 li {
margin: 4 0 0 0;
height: 17px;
}
4 of what? Did you forget to use the "CSS Validator" to check whether your
style sheet is even formally correct? Why 17px? The px unit should normally
be used in user style sheets only. Why do you set the height in the first
place?
.liSpacer {
margin: 0px;
padding: 0px;
height: 12px;
font-size: 10px;
}
Instead, assign a class to an item after which some spacing is desired, and
simply set e.g. margin-bottom: 1em for it.
This works just fine
No it doesn't.
for the li's that have text in them. The ones
that have the class="liSpacer" don't seem to use css that is given.
That element also has text in it, though just one character. It's a wrong
approach, but technically it's an element with text content.
Why would this not take effect?
It's pretty futile to discuss that, since the approach is wrong, you didn't
reveal the URL, and you're not telling what you mean by its not taking
effect.
Is there a way that I can stop
inheritence from the ".liCol1 li" section?
There is no such thing as inheritance from a section. Elements may inherit a
property value from their parent. The way to stop that is to assign a value
to the property for that element.

As a rule of thumb, 105 % of all CSS questions with the word "inheritance"
in them are seriously misguided and do not actually deal with inheritance at
all.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 1 '07 #4

P: n/a
On Feb 1, 6:30 am, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
Scripsit hende...@yahoo.com:
I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects).

Whether you use modern programming is immaterial. CSS is not programming,
though you can write programs that generate, read, modify, or interpret CSS
code.

There is nothing wrong with using tables when you have tabular data. Whether
an address is tabular data is debatable, but the fact is that there are
authors who are "getting aways from using tables" in vain, even making their
pages less logical and more difficult to maintain.
I am running into an issue using ul's.

When you have run into an issue with CSS, it's virtually always a waste of
everyone's time to post a question without revealing the URL.
I will give you the code below:

You are not giving yourself good chances of getting the help you need.
<ul class="liCol1">
<li>Vendor name</li>
<li>Address</li>
<li>City St, Zip</li>
<li>Phone number</li>
<li class="liSpacer">&nbsp;</li>
<li>Data directory</li>
<li>Temp directory</li>
<li class="liSpacer">&nbsp;</li>
<li>DSA keys</li>
</ul>

What's "liCol1"? Class names should be descriptive of meaning and structure,
not cryptic codes for intended formatting.

Why the spacer items? Use vertical margins instead.
and here is the css from an external file:
.ulCol1 {
list-style: none;
text-decoration: none;
margin: 0px;
padding: 0px;
}

Why do you present this snippet? There is no class "ulCOl1" in your markup
snippet.
.liCol1 li {
margin: 4 0 0 0;
height: 17px;
}

4 of what? Did you forget to use the "CSS Validator" to check whether your
style sheet is even formally correct? Why 17px? The px unit should normally
be used in user style sheets only. Why do you set the height in the first
place?
.liSpacer {
margin: 0px;
padding: 0px;
height: 12px;
font-size: 10px;
}

Instead, assign a class to an item after which some spacing is desired, and
simply set e.g. margin-bottom: 1em for it.
This works just fine

No it doesn't.
for the li's that have text in them. The ones
that have the class="liSpacer" don't seem to use css that is given.

That element also has text in it, though just one character. It's a wrong
approach, but technically it's an element with text content.
Why would this not take effect?

It's pretty futile to discuss that, since the approach is wrong, you didn't
reveal the URL, and you're not telling what you mean by its not taking
effect.
Is there a way that I can stop
inheritence from the ".liCol1 li" section?

There is no such thing as inheritance from a section. Elements may inherit a
property value from their parent. The way to stop that is to assign a value
to the property for that element.

As a rule of thumb, 105 % of all CSS questions with the word "inheritance"
in them are seriously misguided and do not actually deal with inheritance at
all.

--
Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/


Jukka,

I am not sure how to take your response to my post. If it was
meant as a sincere reply explaining certain aspects, then I will
appreciate it. If you were responding with an attitude towards
someone who is trying to learn correct ways of coding, then I would
ask you not to reply.

Feb 1 '07 #5

P: n/a
On Feb 1, 3:37 am, Ben C <spams...@spam.eggswrote:
On 2007-02-01, hende...@yahoo.com <hende...@yahoo.comwrote:
Gang,
I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects). I am running into an issue using ul's. I will give you the
code below:

[snip]
.liCol1 li {
margin: 4 0 0 0;
height: 17px;
}
.liSpacer {
margin: 0px;
padding: 0px;
height: 12px;
font-size: 10px;
}
This works just fine for the li's that have text in them. The ones
that have the class="liSpacer" don't seem to use css that is given.

It looks like .liCol1 li is more "specific" than .liSpacer. See CSS 2.1
6.4.3.
Why would this not take effect?

If you make ".liSpacer" ".liCol1 li.liSpacer" instead, it will become
more specific (two classes and one element beats one class and one
element).
Is there a way that I can stop inheritence from the ".liCol1 li"
section? Any help would greatly be appreciated.

Not that I know of. You can give all the non-spacer <li>s their own
class and then you can select them with a selector that won't match the
spacers as well. Otherwise override everthing you set in .liCol1 li in
.liCol1 li.liSpacer to set it back to the default.

Thanks guys for the input. I will play around with what you suggested
and see if I can get things working.

Feb 1 '07 #6

P: n/a
Scripsit he******@yahoo.com:
Jukka,
We are not in a first-name basis, especially since you are cowardish enough
to hide yours.
I would ask you not to reply.
By fullquoting a useful answer and by not addressing any of the concerns
there, including the absence of a URL, you already asked all knowledgeable
people to ignore your further posts.

HTH. HAND.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 1 '07 #7

P: n/a
On 2007-02-01, he******@yahoo.com <he******@yahoo.comwrote:
On Feb 1, 6:30 am, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
[snip]
>As a rule of thumb, 105 % of all CSS questions with the word "inheritance"
in them are seriously misguided and do not actually deal with inheritance at
all.

--
Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/

Jukka,

I am not sure how to take your response to my post. If it was
meant as a sincere reply explaining certain aspects, then I will
appreciate it. If you were responding with an attitude towards
someone who is trying to learn correct ways of coding, then I would
ask you not to reply.
Don't worry about Mr Korpela. He has a certain asperity, but makes good
technical points and my impression is that he is not really a bully.
Feb 1 '07 #8

P: n/a
On Feb 1, 2:14 pm, Ben C <spams...@spam.eggswrote:
On 2007-02-01, hende...@yahoo.com <hende...@yahoo.comwrote:
On Feb 1, 6:30 am, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
[snip]
As a rule of thumb, 105 % of all CSS questions with the word "inheritance"
in them are seriously misguided and do not actually deal with inheritance at
all.
--
Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/
Jukka,
I am not sure how to take your response to my post. If it was
meant as a sincere reply explaining certain aspects, then I will
appreciate it. If you were responding with an attitude towards
someone who is trying to learn correct ways of coding, then I would
ask you not to reply.

Don't worry about Mr Korpela. He has a certain asperity, but makes good
technical points and my impression is that he is not really a bully.


Thats why I worded my post the way I did... basically if you are being
helpful and not a bully thank you... if not keep to yourself. Thanks
again for your help. I tried doing what you said and it worked out
perfectly. Have a good one.

Feb 1 '07 #9

P: n/a
<he******@yahoo.comwrote in message
news:11**********************@a34g2000cwb.googlegr oups.com...
On Feb 1, 2:14 pm, Ben C <spams...@spam.eggswrote:
I am not sure how to take your response to my post. If it was
meant as a sincere reply explaining certain aspects, then I will
appreciate it. If you were responding with an attitude towards
someone who is trying to learn correct ways of coding, then I would
ask you not to reply.

Don't worry about Mr Korpela. He has a certain asperity, but makes good
technical points and my impression is that he is not really a bully.

Thats why I worded my post the way I did... basically if you are being
helpful and not a bully thank you... if not keep to yourself. Thanks
again for your help. I tried doing what you said and it worked out
perfectly. Have a good one.
Geniuses have a tendency to "talk at" or "down" to you without an implied arrogance or
measure of disrespect.

Taking it personally on a newsgroup though only makes you look even sillier.

Take your own advice and just do not respond to Jukka when you feel he is being
overbearing. (He is definitely smart though, so pay attention to him at least.)

Just my $0.02. And no, I do not have an attitude just in case your first thought is to
reply as such.

Be well.

-Lost
Feb 2 '07 #10

P: n/a
hh*******@yahoo.com wrote:
Gang,

I am trying to create/update webpages using CSS and modern
programming (getting away from using tables to place text and
objects). I am running into an issue using ul's. I will give you the
code below:

<ul class="liCol1">
<li>Vendor name</li>
<li>Address</li>
<li>City St, Zip</li>
<li>Phone number</li>
<li class="liSpacer">&nbsp;</li>
<li>Data directory</li>
<li>Temp directory</li>
<li class="liSpacer">&nbsp;</li>
<li>DSA keys</li>
</ul>

and here is the css from an external file:

.ulCol1 {
list-style: none;
text-decoration: none;
margin: 0px;
padding: 0px;
}

.liCol1 li {
margin: 4 0 0 0;
height: 17px;
}

.liSpacer {
margin: 0px;
padding: 0px;
height: 12px;
font-size: 10px;
}

This works just fine for the li's that have text in them. The ones
that have the class="liSpacer" don't seem to use css that is given.
Why would this not take effect? Is there a way that I can stop
inheritence from the ".liCol1 li" section? Any help would greatly be
appreciated.

Also note, that there may be several of these on a page so I was
trying to avoid giving each ul an id.
Try this.

..liSpacer {
list-style-type:none;
}
Feb 2 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.