How do I get the text where I want it ?

Discussion in 'HTML' started by H, Nov 19, 2003.

  1. H

    H Guest

    Ok, so I have a table, and after that I want a javascript to print some
    things, but my printing comes up in the table. How do I get it after the
    table, in the "normal" position ?

    This is my code

    <body>
    <table border="1" width="80%" style="z-index: 1; position: absolute;
    left:10px">
    Some rows and columns

    </table>
    <p style="z-index: 0">Some info about your browser....</p>

    <script language="Javascript" >
    <!--
    // This is the text I want after the table .....
    document.writeln("You're using : " + navigator.appName + " " +
    navigator.appVersion +");
    //-->
    </script>
    </body>

    </html>
     
    H, Nov 19, 2003
    #1
    1. Advertising

  2. H schrieb:
    >
    > Ok, so I have a table, and after that I want a javascript to print some
    > things, but my printing comes up in the table. How do I get it after the
    > table, in the "normal" position ?
    >
    > This is my code
    >
    > <body>
    > <table border="1" width="80%" style="z-index: 1; position: absolute;
    > left:10px">


    position:absolute removes the table from the normal flow and doesn't
    affect the layout of any other elements. Those other elements will just
    pretend the table doesn't even exist. So you have to make sure that the
    space where you're moving your table to is actually empty.

    It's all explained in the CSS2 specification:
    <http://www.w3.org/TR/CSS2/visuren.html#propdef-position>

    Why do you need to position that table, anyway ?



    > document.writeln("You're using : " + navigator.appName + " " +
    > navigator.appVersion +");


    Doh. That's about as useful as telling me the colour of my T-Shirt ;-).


    Matthias
     
    Matthias Gutfeldt, Nov 19, 2003
    #2
    1. Advertising

  3. H wrote:

    > Ok, so I have a table, and after that I want a javascript to print some
    > things, but my printing comes up in the table. How do I get it after the
    > table, in the "normal" position ?
    >
    > This is my code
    >
    > <body>
    > <table border="1" width="80%" style="z-index: 1; position: absolute;
    > left:10px">


    Position absolute takes the table out of the normal document flow. You need
    to create a space for it to sit in through other techniques (or get rid of
    the directive to position absolutely)

    > Some rows and columns
    >
    > </table>
    > <p style="z-index: 0">Some info about your browser....</p>


    z-index doesn't apply to elements which aren't positioned, and some browsers
    have trouble with z-indexes < 1.

    > <script language="Javascript" >


    Why are you using HTML 3.2? For that matter, I don't think HTML 3.2 had a
    style attribute, so this is invalid HTML.

    <script type="text/javascript">

    > <!--
    > // This is the text I want after the table .....
    > document.writeln("You're using : " + navigator.appName + " " +
    > navigator.appVersion +");


    I rather suspect that the user will know this already - and what if they
    don't have JavaScript enabled. If you must generate content with
    JavaScript, then generate all the relevent content (i.e. document.write the
    <p>Some info about your browser....</p> too.)

    > //-->
    > </script>
    > </body>
    > </html>


    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Nov 19, 2003
    #3
  4. H

    H Guest

    "Matthias Gutfeldt" <> skrev i meddelandet
    news:...
    > H schrieb:
    > >
    > > Ok, so I have a table, and after that I want a javascript to print some
    > > things, but my printing comes up in the table. How do I get it after the
    > > table, in the "normal" position ?
    > >
    > > This is my code
    > >
    > > <body>
    > > <table border="1" width="80%" style="z-index: 1; position:

    absolute;
    > > left:10px">

    >
    > position:absolute removes the table from the normal flow and doesn't
    > affect the layout of any other elements. Those other elements will just
    > pretend the table doesn't even exist. So you have to make sure that the
    > space where you're moving your table to is actually empty.

    Ok, I just wondered if there was any way to "start" the normal flow again,
    AFTER the table.

    > Why do you need to position that table, anyway ?

    I need some text in a layer to cover some of the test in the table, thats
    the only way of making it I came up with ..

    > > document.writeln("You're using : " + navigator.appName + " " +
    > > navigator.appVersion +");

    >
    > Doh. That's about as useful as telling me the colour of my T-Shirt ;-).

    Haha yep, I know, but sometimes you may just forget what color it is ...
     
    H, Nov 19, 2003
    #4
  5. H

    H Guest

    > > <body>
    > > <table border="1" width="80%" style="z-index: 1; position:

    absolute;
    > > left:10px">

    >
    > Position absolute takes the table out of the normal document flow. You

    need
    > to create a space for it to sit in through other techniques (or get rid of
    > the directive to position absolutely)
    >
    > > Some rows and columns
    > >
    > > </table>
    > > <p style="z-index: 0">Some info about your browser....</p>

    >
    > z-index doesn't apply to elements which aren't positioned, and some

    browsers
    > have trouble with z-indexes < 1.

    If I get rid of the absolute position, then how could I get a layer, (that
    shall be absolutely positioned in my task) to cover some of the text in the
    table ?

    > > <script language="Javascript" >

    >
    > Why are you using HTML 3.2? For that matter, I don't think HTML 3.2 had a
    > style attribute, so this is invalid HTML.

    I am ? This is the way my book tells me to write it, and the way the editor
    autocompletes it, so I figured that if they both says the same thing, they
    may be on to something.


    > <script type="text/javascript">
    >
    > > <!--
    > > // This is the text I want after the table .....
    > > document.writeln("You're using : " + navigator.appName + " " +
    > > navigator.appVersion +");

    >
    > I rather suspect that the user will know this already - and what if they
    > don't have JavaScript enabled. If you must generate content with
    > JavaScript, then generate all the relevent content (i.e. document.write

    the
    > <p>Some info about your browser....</p> too.)


    Yes, I know. but it all started out as a school task, and I decided to keep
    that, just to show what I meant with "continuing the flow"
     
    H, Nov 19, 2003
    #5
  6. H

    rf Guest

    "H" <> wrote in message
    news:O1Tub.38479$...
    >
    > "Matthias Gutfeldt" <> skrev i meddelandet
    > news:...
    > > H schrieb:
    > > > <table border="1" width="80%" style="z-index: 1; position:

    > absolute;
    > > > left:10px">

    > >
    > > position:absolute removes the table from the normal flow and doesn't
    > > affect the layout of any other elements. Those other elements will just
    > > pretend the table doesn't even exist. So you have to make sure that the
    > > space where you're moving your table to is actually empty.


    > Ok, I just wondered if there was any way to "start" the normal flow again,
    > AFTER the table.


    The normal flow *is* "started". It never stopped. It's just that the table
    is taken out of the normal flow.

    Do it the other way round. Leave the table in the normal flow and absolutely
    position the text over the top of the table.

    Cheers
    Richard.
     
    rf, Nov 19, 2003
    #6
  7. H

    H Guest

    "rf" <> skrev i meddelandet
    news:dcTub.18244$...
    >
    > "H" <> wrote in message
    > news:O1Tub.38479$...
    > >
    > > "Matthias Gutfeldt" <> skrev i meddelandet
    > > news:...
    > > > H schrieb:
    > > > > <table border="1" width="80%" style="z-index: 1; position:

    > > absolute;
    > > > > left:10px">
    > > >
    > > > position:absolute removes the table from the normal flow and doesn't
    > > > affect the layout of any other elements. Those other elements will

    just
    > > > pretend the table doesn't even exist. So you have to make sure that

    the
    > > > space where you're moving your table to is actually empty.

    >
    > > Ok, I just wondered if there was any way to "start" the normal flow

    again,
    > > AFTER the table.

    >
    > The normal flow *is* "started". It never stopped. It's just that the table
    > is taken out of the normal flow.
    >
    > Do it the other way round. Leave the table in the normal flow and

    absolutely
    > position the text over the top of the table.
    >

    AHH! So perfectly clear !! Can't believe I didn't think of that one ....

    Anyways, Thanks for all the answers sofar !!!
    I have a feeling more questions will be coming ....
     
    H, Nov 20, 2003
    #7
  8. H wrote:


    > If I get rid of the absolute position, then how could I get a layer, (that
    > shall be absolutely positioned in my task) to cover some of the text in
    > the table ?


    Then you need to be more careful with your positioning. Probably by creating
    another <div> around that content and making it position relative to act as
    a new local positioning context.

    >> Why are you using HTML 3.2? For that matter, I don't think HTML 3.2 had a
    >> style attribute, so this is invalid HTML.


    > I am ? This is the way my book tells me to write it


    Wonderful another book with mistakes in it.

    >, and the way the editor autocompletes it,


    s/book/editor

    > so I figured that if they both says the same thing, they may be on to
    > something.


    On to a time machine back to 1994

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Nov 20, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. eddy
    Replies:
    0
    Views:
    341
  2. Rehor
    Replies:
    2
    Views:
    351
    Rehor
    Oct 22, 2004
  3. Replies:
    1
    Views:
    462
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 19, 2005
  4. Replies:
    4
    Views:
    181
    Ted Zlatanov
    Sep 13, 2006
  5. pavi
    Replies:
    0
    Views:
    1,391
Loading...

Share This Page