Reply to Message Icon Go to Main Page Icon

horizontal align with css?

Original Message
Name: tImmaY
Date: July 7, 2004 at 00:34:37 Pacific
Subject: horizontal align with css?
OS: Windows XP Pro SP1
CPU/Ram: AMD Athlon XP 2400+/512 m
Comment:

hey, i've done kind of a lot with CSS but i've never come across this, so i was wondering if there was a way that you could horizontally align something (like the information within a table data cell) in css? besides like padding-left and padding-right..?


Report Offensive Message For Removal


Response Number 1
Name: jam14online
Date: July 7, 2004 at 07:54:35 Pacific
Subject: horizontal align with css?
Reply: (edit)

For your specific example, you can use the text-align property to center the information in that cell.

The best method I have found is to make an element a percentage width, for example 65%. Then you can use the margin-left property and set it to 17.5%. This is half of what is left (100 - 65 = 35 / 2 = 17.5), i.e. enough to have an equal margin on each side.

I hope this helps,


James



Report Offensive Follow Up For Removal

Response Number 2
Name: andyhargreaves
Date: July 7, 2004 at 11:08:16 Pacific
Subject: horizontal align with css?
Reply: (edit)

Hi

I use text-align: center in CSS and it works very well. Seems simpler to me than using margins.


Report Offensive Follow Up For Removal

Response Number 3
Name: tImmaY
Date: July 13, 2004 at 00:49:14 Pacific
Subject: horizontal align with css?
Reply: (edit)

thanks james, thats a good idea.. i've used something similar to that to align tables right.

thanks andy but that doesn't quite accomplish what i was thinking to do..


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: horizontal align with css?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software