Leandro Guedes
Leandro Guedes

Reputation: 111

Elements inside <td style="

I'm trying to put the colspan, valign and align in the following piece

<td style="background-color:#000333" colspan="4" valign="middle" align="center">

all inside the style="...", to have something like:

<td style="background-color:#000333;colspan:4;valign:'middle'; align:'center'>

Is there any way to do this?

Upvotes: 0

Views: 31830

Answers (2)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201758

You cannot do that because there is no way in CSS to do the job of colspan (except in a special case where its value equals the total number of columns, and even then only using a proposed CSS extension that does not work consistently across modern browsers, not to mention old browsers).

Upvotes: 0

v010dya
v010dya

Reputation: 5848

You will be unable to achieve colpan results with CSS I stand corrected, you can in CSS3. But text-align:center will get and vertical-align:middle for vertical alignment.

With that said, please consider using proper CSS rather than stuffing things into the style tags, that will make your (and everybody else's) job much easier in the future. That is as simple as saying

<td class='myclass'>

and then inside your CSS file

td.myclass
{
  text-align:center;
  vertical-align:middle;
}

Upvotes: 1

Related Questions