|
-
Mar 22nd, 2004, 09:56 AM
#1
Align text in the browser window....
Is it possible to use CSS to align a div with text to the center of the browser window.
If I use
margin-left: auto;
margin-right: auto;
I can align it to the center horizontaly, but how do I do it verticaly too?
PS: There is no scroolbars on the page.
-
Mar 22nd, 2004, 10:07 AM
#2
Frenzied Member
Your code doesn't centre it in FireFox or IE. This will move it to a certain opint, but I'm not sure how to centre it inpedendent of the resolution, I'd use JavaScript.
Code:
div[id=MyDiv] {
margin-left: 200px;
margin-top: 500px
}
Have I helped you? Please Rate my posts. 
-
Mar 22nd, 2004, 10:47 AM
#3
My code are centering it horizontally in IE, FireFox, and FireBird.... ...have tested it...
Yeah I guess I could use JS, but I was hoping I didn't have to use it. I am not good at it and the cource I am taking is just using (X)HTML, CSS, PHP, MySCL, and no JS...
-
Mar 22nd, 2004, 11:53 AM
#4
Frenzied Member
Originally posted by NoteMe
My code are centering it horizontally in IE, FireFox, and FireBird.... ...have tested it...
Yeah I guess I could use JS, but I was hoping I didn't have to use it. I am not good at it and the cource I am taking is just using (X)HTML, CSS, PHP, MySCL, and no JS...
***** the course then, JavaScript is one of the most important tools of good design and interactivity, you need it...
Cheers!
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Mar 22nd, 2004, 12:08 PM
#5
Yeah, failing the cource and not get my batcher is the way to go to make this happen.....think I will redesign the site rather then use JS...sorry...
-
Mar 22nd, 2004, 12:20 PM
#6
Frenzied Member
Originally posted by NoteMe
Yeah, failing the cource and not get my batcher is the way to go to make this happen.....think I will redesign the site rather then use JS...sorry...
Whatever you say, the course is sucky since it doesn't include one of the most important client side scripting languages... Go beat up the guy who made it or something like that... And how can you fail it by improvising? Doesn't it just show that you can do more than what 'they' expect?
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Mar 22nd, 2004, 02:44 PM
#7
Stuck in the 80s
Originally posted by vbNeo
***** the course then
This is about the stupidest statement I've read all day.
-
Mar 22nd, 2004, 02:50 PM
#8
Frenzied Member
Originally posted by The Hobo
This is about the stupidest statement I've read all day.
Means I'm good at SOMETHING
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Mar 22nd, 2004, 03:20 PM
#9
Frenzied Member
Originally posted by NoteMe
My code are centering it horizontally in IE, FireFox, and FireBird.... ...have tested it...(
Could you post the code as it is in your page please? I just want to see why it didn't work for me.
Have I helped you? Please Rate my posts. 
-
Mar 22nd, 2004, 03:54 PM
#10
Originally posted by vbNeo
Whatever you say, the course is sucky since it doesn't include one of the most important client side scripting languages... Go beat up the guy who made it or something like that... And how can you fail it by improvising? Doesn't it just show that you can do more than what 'they' expect?
Thats like doing your ASM project in VB and tell the teacher that you know more then the course...you are not answering the question, and you will fail...
-
Mar 22nd, 2004, 03:54 PM
#11
Originally posted by The Hobo
This is about the stupidest statement I've read all day.
Thanks...at least someone understands me....
-
Mar 22nd, 2004, 03:55 PM
#12
Originally posted by Acidic
Could you post the code as it is in your page please? I just want to see why it didn't work for me.
Will hook up my laptop right away, and post it....
-
Mar 22nd, 2004, 04:01 PM
#13
-
Mar 22nd, 2004, 04:19 PM
#14
Frenzied Member
OK, I don't think it can be done. Sorry.
Maybe just make it a certain distance from the top using margin-top: 150px;
I know this wouldn't look nice on all resolutions but it would guarantee enough space for a banner.
Have I helped you? Please Rate my posts. 
-
Mar 22nd, 2004, 04:24 PM
#15
Yeah but the problem is when the browser window is resized....well well...I guess I could try to do something like this guy have done with the grey boarders around the text...not sure if it would work tho'...
www.bersvendsen.com
-
Mar 23rd, 2004, 06:00 AM
#16
It can be done, but only for a pixel-fixed height.
http://www.wpdfd.com/editorial/thebox/deadcentre4.html
JavaScript is not an important design tool. A page should not lose any design element just because of disabled JavaScript. Even popup menus can be done in CSS in compliant browsers. But the important thing is to degrade gracefully in case of missing JS.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 24th, 2004, 01:57 PM
#17
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|