|
|
|
|
![]() ![]() |
Jul 15 2007, 10:53 AM
Post
#1
|
|
|
Member - Active Contributor Group: Members Posts: 93 Joined: 11-June 07 Member No.: 22,564 |
I'm now rebuilding my website, and I have come against a problem of which I don't know how to fix it. I am using div tags (of course) but what I want to know is how to center the site, without having the text layout centered. Does anyone know how? I have not found any solutions yet. Thanks in advance.
MediYama |
|
|
|
Jul 15 2007, 11:02 AM
Post
#2
|
|
|
Oh come on Mrs. B! Group: Members Posts: 648 Joined: 6-June 07 From: Tasmania, Australia Member No.: 22,422 |
ummm...
"nice share" u arent even reading wot ppl write sirat. i have my whole site centered just with center tags. but, everything else is in table inside tables inside tables so it doesnt affect them. but, if u want to center your site like that, u could use margins? the same on both side. |
|
|
|
Jul 15 2007, 11:22 AM
Post
#3
|
|
|
Member - Active Contributor Group: Members Posts: 93 Joined: 11-June 07 Member No.: 22,564 |
Sten, when I use center tags,
All the text is also centered like this, which I don't want I want the site to be centered (the background, the boxes) but the text to just be slammed to the left side. |
|
|
|
Jul 15 2007, 11:25 AM
Post
#4
|
|
|
Oh come on Mrs. B! Group: Members Posts: 648 Joined: 6-June 07 From: Tasmania, Australia Member No.: 22,422 |
Like i said, margins
it will put it all in the middle if you make the left and right margins the same. |
|
|
|
Jul 15 2007, 11:26 AM
Post
#5
|
|
|
Member - Active Contributor Group: Members Posts: 93 Joined: 11-June 07 Member No.: 22,564 |
Alright, I'll try. Thanks.
Edit: It does what it's supposed to do, but it makes a problem with different resolutions... Any other solution? Another edit: Solved my problem, thanks anyway! This post has been edited by MediYama: Jul 15 2007, 07:54 PM |
|
|
|
Jul 15 2007, 08:56 PM
Post
#6
|
|
|
Premium Member Group: Members Posts: 219 Joined: 13-February 07 Member No.: 20,371 |
just use css to set the left and right margin to auto, and you'll be able to center your div (assuming you also have a width set for the div).
An example would be: CODE <div id="content" style="width: 745px; margin-left: auto; margin-right: auto;">the content here</div> So if centering your site, you would put your website inside of that. Hope this helps, if it doesn't I would recommend posting a link to either your website, or an example of an attempt at what you are doing, so we can take a look at the code, and provide more specific help. |
|
|
|
Jul 16 2007, 12:27 AM
Post
#7
|
|
|
Super Member Group: [HOSTED] Posts: 763 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 |
I'm now rebuilding my website, and I have come against a problem of which I don't know how to fix it. I am using div tags (of course) but what I want to know is how to center the site, without having the text layout centered. Does anyone know how? I have not found any solutions yet. Thanks in advance. MediYama If you want to center horizontally your div or any other block element you can use achieve this with: CODE <div style="width:10em;margin:0 auto">div content</div> Best regards, |
|
|
|
Jul 16 2007, 09:53 AM
Post
#8
|
|
|
Member - Active Contributor Group: Members Posts: 93 Joined: 11-June 07 Member No.: 22,564 |
Well I fixed it already, using margin: 0 auto; in the css file.
|
|
|
|
Jul 16 2007, 10:35 AM
Post
#9
|
|
|
Oh come on Mrs. B! Group: Members Posts: 648 Joined: 6-June 07 From: Tasmania, Australia Member No.: 22,422 |
oh yeah, woops, forgot to say!
margins dont work too well in other resolutions. i had that problem once when i was making a website for school for an assignment or something. anyway, u fixed it and thats wot counts |
|
|
|
Jul 16 2007, 01:48 PM
Post
#10
|
|
|
Premium Member Group: Members Posts: 219 Joined: 13-February 07 Member No.: 20,371 |
auto margins will work fine in other resolutions....it is when you have margins set so that they are not auto or not percentage values that you run into problems.
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 12th October 2008 - 09:41 AM |