This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by elton mbofana
about 11 years

How do you incorporate the colspan property into the CSS file?

I was designing a table and i wished to style my header in the table using CSS. Instead of using the attribute colspan=”4” (my table has 4 columns by the way) directly in the html document, i wanted to use id =”header”. However, it seems the colspan property is not reading the 4 columns want and just effectively applying to 1 column.

CSS file: tonito.css

#header {
font-size: 15; font-family: Arial; color: Brown; colspan=4;

}

Answer 5160484395c35e36c80034c0

1 vote

Permalink

There is small ongoing argument in the HTML community whether a column’s span is considered style (CSS) or structure (HTML). In previous versions of CSS, there was no standard way to set the span of a column, although browsers did support their own custom css attribute (for example, -ms-column-span for IE).

In order to make sure it works on all browsers, you should use all of these together within your selector:

column-span: 4; /* W3C */
-webkit-column-span: 4; /* Safari & Chrome */
-moz-column-span: 4; /* Firefox */
-ms-column-span: 4; /* Internet Explorer */
-o-column-span: 4; /* Opera */

However, this will only work in current generation browsers. I would suggest not setting the colspan in CSS, but the choice is yours.

points
Submitted by Scott Korin
almost 11 years