Aligning table cells


#1

I've finished 6. Clickable Photo Page but I'm wondering how you align the table cells?

I'd like to align my table header to the center. My code currently looks like this:

<thead>
   <th style = "colspan:3">Photos</th>
</thead>

I've tried changing it to <th style = "colspan:3; align: center">Photos</th>, as well as adding <p style = "text-align: center"> and <span style = "text-align: center"> but none of them work. :')


#2

You don't need to have colspan in a style as it is an attribute to <table>. So just move it out and it should be fine.

<thead>
   <th colspan="3"> blah blah </th>
</thead>

you can also add a style="text-align: center;" in your <th> beside colspan. But I think colspan is good enough.


#3

Thanks! :slight_smile:

I'm not sure why I put colspan in a style haha. I think I must've misremembered from the exercise they used it in.


#4

No problem! Happy coding!


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.