How Do You Incorporate The Colspan Property Into The CSS File?

Skip to ContentProfile image of tonymbofanaSubmitted by tonymbofanaalmost 12 yearsHow 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.

Profile image of scott.korinSubmitted by scott.korinover 11 years

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.Checker DenseBeginner Friendly4 Lessons
  • Free course

    Learn JavaScript

    Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Checker DenseBeginner Friendly11 Lessons
  • Free course

    Learn HTML

    Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Checker DenseBeginner Friendly6 Lessons
Explore full catalog

Từ khóa » Html Td Colspan Style