Shalin
Shalin

Reputation: 1481

Align text inside an html table

I am a CSS newbie, I have a html table as given below

+-------------------------------+---------------------+
|Text Sample                    | text                |
+-------------------------------+---------------------+
|Text Sample Sample             | text                |
+-------------------------------+---------------------+

I want to change the alignment of Text1s as below :

+-------------------------------+---------------------+
|          Text Sample          | text                |
+-------------------------------+---------------------+
|          Text1  Sample Sample | text                |
+-------------------------------+---------------------+

How this be done using CSS?

Upvotes: 0

Views: 59

Answers (2)

sevenseacat
sevenseacat

Reputation: 25029

Are you just trying to indent the first cell of every table row? If so, one way to do it would be like so:

tr td:first-child { padding-left: 30px }

(or insert your own value)

Upvotes: 1

Pitsanu Swangpheaw
Pitsanu Swangpheaw

Reputation: 672

you may consider to add margin-left for td:first-child

// style.css
td:first-child { margin-left: 30px; }

Upvotes: 0

Related Questions