What's wrong with this? (CSS)

B

bjg

<style>
..sf span {
display: block;
}
..sf:before {
content: string("&middot;&nbsp;");
}
</style>

<b>Special Features:</b>
<div class="sf">
<span>Dolby Digital 5.1</span>
<span>Theatrical trailers</span>
</div>

This is to comply with HTML 4.01 - haven't tested it yet...

TIA
 
M

m

bjg said:
<style>
.sf span {
display: block;
}
.sf:before {
content: string("&middot;&nbsp;");
}
</style>

<b>Special Features:</b>
<div class="sf">
<span>Dolby Digital 5.1</span>
<span>Theatrical trailers</span>
</div>

This is to comply with HTML 4.01 - haven't tested it yet...

TIA
______________________
So, take a second to put the rest of the tags
around it and send it to the validator.

Offhand, though, I suspect you
really need <h#> (where '#' is a number)
instead of <span> and <b>. Headers are
block elements by default, and are more natural
for what (I *think*) is your meaning.

If you don't use <h#> for <b>, at least
substitute <strong>.
 
T

Toby A Inkster

bjg said:
<style>
.sf span {
display: block;
}
.sf:before {
content: string("&middot;&nbsp;");
}
</style>

<b>Special Features:</b>
<div class="sf">
<span>Dolby Digital 5.1</span>
<span>Theatrical trailers</span>
</div>

Several things wrong:

1. You probably want '.sf span:before' and not '.sf:before'.

2. What is 'string("&middot;&nbsp;")' supposed to mean. Try instead:

content: "\B7\A0";

3. You do realise that generated content doesn't work in IE?

4. Why use '<b>...</b>' when you can use a more meaningful element like
'<h4>...</h4>' (or <h5> or whatever logically fits in with your heading
structure)

5. Why use <div> and <span> when you can use <ul> and <li>?
 
S

somebody

Toby A Inkster said:
Several things wrong:

1. You probably want '.sf span:before' and not '.sf:before'.

2. What is 'string("&middot;&nbsp;")' supposed to mean. Try instead:

content: "\B7\A0";

3. You do realise that generated content doesn't work in IE?

4. Why use '<b>...</b>' when you can use a more meaningful element like
'<h4>...</h4>' (or <h5> or whatever logically fits in with your heading
structure)

5. Why use <div> and <span> when you can use <ul> and <li>?

That's what I am using currently, but I want to have more control over it. I
don't like how ul and li add new lines. Is there a way to fix this?
 
J

Jukka K. Korpela

Toby A Inkster said:
Several things wrong:

Indeed, starting from the Subject line - no hint of the actual topic of
the question, except a hint that it might have better belonged to
another group.

I don't think we can use enough time to give a _comprehensive_ answer
to the question what's wrong, but I might add the lack of a required
2. What is 'string("&middot;&nbsp;")' supposed to mean. Try
instead:

content: "\B7\A0";

Besides, trying to use the middle dot as a surrogate for a list bullet
is pathetic. The middle dot is supposed to be a small punctuation
character (see http://www.cs.tut.fi/~jkorpela/latin1/3.html#B7 ).
If it looks like a bullet, you need a better font.
 
J

Jukka K. Korpela

somebody said:
That's what I am using currently, but I want to have more control
over it. I don't like how ul and li add new lines. Is there a way
to fix this?

As usual, explaining the problem is more fruitful than asking help on a
completely wrong approach to solving an unrevealed problem.

Keep trying to explain the real problem. Using your real name, address,
and URL might help. You probably need something very simple like margin
properties.
 
D

Dylan Parry

Jukka said:

An interesting an informative read, Jukka. I thought I should point out a
grammatical error that I noticed; In the last paragraph of that
section you write:

" Moreover, the bullet character is in the so-called Windows character
set, so it can used in text processing fairly safely if desired"

Which, unless I am mistaken (and I often am) is missing a "be" between
"can" and "used".
 
B

bjg

Jukka K. Korpela said:
As usual, explaining the problem is more fruitful than asking help on a
completely wrong approach to solving an unrevealed problem.

Keep trying to explain the real problem. Using your real name, address,
and URL might help. You probably need something very simple like margin
properties.

Sorry i posted the topic at work, and then followed up at home in which i
didn't had a diff default name.

Anyway, the problem...

I want to be able to display a list of bullet-type points without new lines
in between each line. When i use <li> and <ul> it spreads it out too much.
Is there a good way to achieve a list without having new lines everywhere,
while also complying with standards..

TIA
 
G

GD

bjg said:
I want to be able to display a list of bullet-type points without new lines
in between each line. When i use <li> and <ul> it spreads it out too much.

There are no new lines between elements in web pages. The gap you are
seeing is a margin.

Different browsers use different combinations of margin and padding on
list elements so start with:

ol,ul {
padding:0;
margin:0;
}

li {
padding:0;
margin:0;
}


And adjust the margins/padding to suit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top