8 Replies Latest reply on Jun 19, 2008 10:53 AM by

    Align to top of browser window

    AshPollak
      Hey all

      Yeseterday was having trouble centering content to a page, thanks Murray for helping me out on that one. Today back to my original problem - getting my content to sit flush with the top of the browser window.

      Here is the link:

      http://darcystrial.apollak.fastmail.fm/index_trial3.html

      Have tried to add in the top div tag:

      Like this:

      <div style="width: 658; margin:0 auto;text-align:left; top:0; ">

      (Does nothing)

      and this

      <div style=" position: absolute; top: 0px; width: 658; margin:0 auto;text-align:left; position: top:0; ">

      (mucks up the centering)

      Any ideas!

      Ash

      P.S - I know my code needs a lot of tidying in other places....
        • 1. Re: Align to top of browser window
          TC2112
          Hello,

          Zero out the margin for the body so the browser doesn't use it's default.

          Change this:

          body,td,th {
          font-family: Arial, Helvetica, sans-serif;
          font-size: 11px;
          color: #E8E8E8;
          vertical-align: top;
          clip: rect(auto,auto,auto,auto);
          }

          To this:

          body,td,th {
          margin:0;
          padding:0;
          font-family: Arial, Helvetica, sans-serif;
          font-size: 11px;
          color: #E8E8E8;
          vertical-align: top;
          clip: rect(auto,auto,auto,auto);
          }

          Take care,
          Tim
          • 2. Re: Align to top of browser window
            AshPollak Level 1
            Fantastic!!! Knew it was simple... just to check -- it would be great if the bottom did the same... The grey footer strip, filling in to the end of the page. Can this be done is a similar way? Or is it a question of defining a specific tag for that section of the content.

            Ash
            • 3. Re: Align to top of browser window
              Level 7
              Get rid of the clip style, too.

              --
              Murray --- ICQ 71997575
              Adobe Community Expert
              (If you *MUST* email me, don't LAUGH when you do so!)
              ==================
              http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
              http://www.dwfaq.com - DW FAQs, Tutorials & Resources
              ==================


              "TC2112" <webforumsuser@macromedia.com> wrote in message
              news:g3ap72$i2l$1@forums.macromedia.com...
              > Hello,
              >
              > Zero out the margin for the body so the browser doesn't use it's default.
              >
              > Change this:
              >
              > body,td,th {
              > font-family: Arial, Helvetica, sans-serif;
              > font-size: 11px;
              > color: #E8E8E8;
              > vertical-align: top;
              > clip: rect(auto,auto,auto,auto);
              > }
              >
              > To this:
              >
              > body,td,th {
              > margin:0;
              > padding:0;
              > font-family: Arial, Helvetica, sans-serif;
              > font-size: 11px;
              > color: #E8E8E8;
              > vertical-align: top;
              > clip: rect(auto,auto,auto,auto);
              > }
              >
              > Take care,
              > Tim
              >

              • 4. Re: Align to top of browser window
                Level 7
                > Can this be done is a similar way?

                No - in that case, you'd have to use a 'faux column' approach with a
                background image on the page.

                --
                Murray --- ICQ 71997575
                Adobe Community Expert
                (If you *MUST* email me, don't LAUGH when you do so!)
                ==================
                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                ==================


                "AshPollak" <webforumsuser@macromedia.com> wrote in message
                news:g3apmi$iiu$1@forums.macromedia.com...
                > Fantastic!!! Knew it was simple... just to check -- it would be great if
                > the
                > bottom did the same... The grey footer strip, filling in to the end of the
                > page. Can this be done is a similar way? Or is it a question of defining a
                > specific tag for that section of the content.
                >
                > Ash
                >

                • 5. Re: Align to top of browser window
                  Level 7
                  On Wed, 18 Jun 2008 10:49:06 +0000 (UTC), "TC2112"
                  <webforumsuser@macromedia.com> wrote:

                  >Hello,
                  >
                  > Zero out the margin for the body so the browser doesn't use it's default.
                  >

                  >
                  > To this:
                  >
                  > body,td,th {
                  > margin:0;
                  > padding:0;
                  > font-family: Arial, Helvetica, sans-serif;
                  > font-size: 11px;
                  > color: #E8E8E8;
                  > vertical-align: top;
                  > clip: rect(auto,auto,auto,auto);
                  > }
                  >
                  > Take care,
                  > Tim


                  I would suggest it better to NOT have the css code for td & th
                  together - as you probably don't want zero padding inside table cells
                  .

                  --

                  ~Malcolm~*...
                  ~*
                  • 6. Re: Align to top of browser window
                    kiss4me08 Level 1
                    thanks for the useful information
                    • 7. Re: Align to top of browser window
                      AshPollak Level 1
                      At the moment I've got a 1 column table with a set height, but when you scroll down the page there is still a very small space at the base of the page. I would like it so that whatever window size, this grey colour covers into the base of the page - scaling to fit... What what the code be.

                      Thanks as always - really helping me get back up to speed here!

                      Ash
                      ------

                      > Can this be done is a similar way?

                      No - in that case, you'd have to use a 'faux column' approach with a
                      background image on the page.
                      • 8. Re: Align to top of browser window
                        The code help full but i have doubt whether it will work both in IE and firefox?