Results 1 to 17 of 17

Thread: Align text in the browser window....

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    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.

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    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.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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...

  4. #4
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    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.

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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...

  6. #6
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    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.

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by vbNeo
    ***** the course then
    This is about the stupidest statement I've read all day.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    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.

  9. #9
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    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.

  10. #10

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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...

  11. #11

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by The Hobo
    This is about the stupidest statement I've read all day.
    Thanks...at least someone understands me....

  12. #12

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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....

  13. #13

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Or even better here it is...


    http://www.noteme.com/web/noteme.shtml

  14. #14
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    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.

  15. #15

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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

  16. #16
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  17. #17

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Ohhh...my...god...CornedBee......I have done so much effort to work around it.......and I am delivering it tomorrow, and I am nearly finished. And first now I saw your post......well....at least thanks for the link. Will remember that CSS so I can use it in an other project later. Thanks a LOT...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width