4 replies [Last post]
MaxJ
Offline
Regular
Last seen: 16 years 7 weeks ago
Joined: 2003-08-28
Posts: 36
Points: 0

Controlling flow next to floats.

The CSS2.1 draft spec says this;

http://www.w3.org/TR/CSS21/visuren.html#flow-control

i.e. "clear" applies to block level elements.

Now, a little further down the page are some float examples and one uses clear on a span tag.

My question for any CSS spec expert is this:

What is the display value for the <span> tag?

Isn't it inline???

I looked at the suggested CSS defaults for each tag at the end of the document but span is not listed. How can a <span> be a block level element as required by the 2.1 spec?

Can someone knowledgeable please explain!

Thanks,

Max

co2
co2's picture
Offline
Leader
UK
Last seen: 11 years 27 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

CSS 2.1/2 float issues

A span is indeed an inline element. However, as the note suggests. Only in CSS2 and 2.1 is a clear attribute allowed to be used on block level elements only. It goes on to say that 'implementations' i.e. browser support, may still adhere to CSS1 for such occurrences i.e. allowance of the clear on inline elements. That's my understanding anyway. Wink

The next sentence is true. The previous sentence is false. Discuss...

MaxJ
Offline
Regular
Last seen: 16 years 7 weeks ago
Joined: 2003-08-28
Posts: 36
Points: 0

Found this

Just found this at W3 site:

http://lists.w3.org/Archives/Public/www-style/2004Feb/0233.html

Extract form above link:

Quote:

# #sibling { clear: right; color: red }

I thought we just established that 'float' does not apply to
inline elements?

CSS WG response:
The example is indeed inaccurate, but we're going to leave
it for now.

For the CSS WG,
Bert

Max

co2
co2's picture
Offline
Leader
UK
Last seen: 11 years 27 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

CSS 2.1/2 float issues

Laughing out loud :roll:

Don'tcha love them!

I must've looked reasonably clever with my answer! Laughing out loud

The next sentence is true. The previous sentence is false. Discuss...

MaxJ
Offline
Regular
Last seen: 16 years 7 weeks ago
Joined: 2003-08-28
Posts: 36
Points: 0

Note

This is what the CSS 2.1 note says, just in case anyone else is interested!

Max

Quote:
Note. This property applied to all elements in CSS1. Implementations may therefore have supported this property on all elements. In CSS2 and CSS 2.1 the 'clear' property only applies to block-level elements. Therefore authors should only use this property on block-level elements. If an implementation does support clear on inline elements, rather than setting a clearance as explained above, the implementation should force a break and effectively insert one or more empty line boxes (or shifting the new line box downward as described in section 9.5) to move the top of the cleared inline's line box to below the respective floating box(es).