Another stylesheet Question  | |
May 17th, 2004, 08:45 AM
|
#1 (permalink)
| | Registered User
Join Date: Oct 2001
Posts: 4,097
| Another stylesheet Question
whats the best way to align something in the middle of the page?
in order to align it in the center i have this so far:
The text you see is inside this box:
#main {
background-color: #2e2e30;
padding: 1px;
position: absolute;
top: 280px;
right: 370px;
width: 300px;
border-top: #FFF dotted 1px;
border-bottom: #FFF dotted 1px;
}
for position i am using 'absolute', but since i am a newb at all this i am wondering if there is a better way?
if you resize the page everything kind of messes up, so that led me to thinking whether i used the correct syntax to position #main ?
Last edited by ClubMed : May 17th, 2004 at 10:25 AM.
|
| |
May 17th, 2004, 09:13 AM
|
#2 (permalink)
| | Retired mostly.
Join Date: Oct 2001 Location: Finland
Posts: 5,144
|
I would put in the <div id="main"> another parameter like this ->
<div id="main" align="center">
//edit:
Except for some odd reason, it doesn't work
//edit3:
Wth is up with this forum... I edit and it shows my edit, I view it again, and the edit is gone..
Sigh.
But, you seem to have put the text-align:center in the right place already, so no need to re-add my previous edit...
Last edited by muno : May 17th, 2004 at 09:30 AM.
|
| |
May 17th, 2004, 09:22 AM
|
#3 (permalink)
| | Registered User
Join Date: Oct 2001
Posts: 4,097
|
yeah just tried and it didnt work. |
| |
May 17th, 2004, 09:34 AM
|
#4 (permalink)
| | Registered User
Join Date: Oct 2001
Posts: 4,097
|
in response to your 2nd and 3rd edits, yeah im playing around with it right now, it all messed up. |
| |
May 17th, 2004, 09:44 AM
|
#5 (permalink)
| | Retired mostly.
Join Date: Oct 2001 Location: Finland
Posts: 5,144
|
It looks fine to me, alignment wise I mean  |
| |
May 17th, 2004, 10:25 AM
|
#6 (permalink)
| | Registered User
Join Date: Oct 2001
Posts: 4,097
|
you probably looked at the page after i gave up the initial idea  |
| |
May 17th, 2004, 02:40 PM
|
#7 (permalink)
| | Member
Join Date: Mar 2004
Posts: 75
|
try this:
top: 50%;
left: 50%;
margin-top: -95px; /* half the height of the object (div,image,etc) (negative sign needed) */
margin-left: -150px; /* half the width of the object (div,image,etc) (negative sign needed) */
i notice you dont have a height specified in your #main. try specifying a height and then modify the code i gave you. that SHOULD horizontally and vertically align that sucker so its right in the middleof the page. good luck with that |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |