This forum is now read-only. Please use our new forums! Go to forums
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
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.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency