home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Another stylesheet Question

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1395
Discussions: 200,927, Posts: 2,379,139, Members: 246,295
Old May 17th, 2004, 08:45 AM   Digg it!   #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.
ClubMed is offline   Reply With Quote
Old 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.
muno is offline   Reply With Quote
Old May 17th, 2004, 09:22 AM     #3 (permalink)
Registered User
 
Join Date: Oct 2001
Posts: 4,097
yeah just tried and it didnt work.
ClubMed is offline   Reply With Quote
Old 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.
ClubMed is offline   Reply With Quote
Old 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
muno is offline   Reply With Quote
Old 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
ClubMed is offline   Reply With Quote
Old 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
sice is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice requested Creosote Webmastering and Programming 4 August 14th, 2003 03:12 AM
Color Scheming PHP scripts, I made. ChoaticWhisper Webmastering and Programming 3 May 24th, 2002 09:56 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2867)
Is the PSU I received dead? (10)
windows vista security holes (9)
HIS HD5770 graphic card question (15)
Foreign voltage (10)
Print spooler problem (13)
Install XP pro and a Vista laptop ?.. (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
Ideal cheap graph card for PC-Gamin.. (15)
New Computer wont recognize XP disc (7)
EVGA 9800 gtx help with finding a g.. (8)
World's largest Monopoly Game using.. (331)
Modern Warfare 2: Who Bought It? (61)
Recent Discussions
Fire in DVD (2)
Regular Build (0)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)
Have you switched yet? (84)
Install XP pro and a Vista laptop ?? (10)
Wireless Router+Cable Modems and Much.. (0)
Optical Audio A-B Switch (1)
windows vista security holes (9)
The NTDVM CPU has encountered an ille.. (24)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
monitor will not turn on at all, (1)
World's largest Monopoly Game using G.. (331)
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
EVGA 9800 gtx help with finding a goo.. (8)
Problem with speed step/turbo boost? (1)
Modern Warfare 2: Who Bought It? (61)


All times are GMT -4. The time now is 02:49 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28