css positioning works but bloats page

Discussion in 'XML' started by Roy, Jul 31, 2004.

  1. Roy

    Roy Guest

    I'd like to create a web page that highlights sections of text with
    different background colors. The sections can overlap. I tried span
    tags at first, but that broke down depending on how the sections
    overlapped. Combining CSS positioning with xmlns sounded like a
    promising solution to the problem.

    What I've come up with gets the job done, but it involves creating a
    copy of the text for each background color (2 colors --> 2 copies, 3
    colors --> 3 copies, N colors --> N copies). An example page is
    included below. Is there a more efficient way to do this?

    Thanks,
    Roy


    <html xmlns:myns>
    <style>
    @media all
    {
    myns\:thetext { position:absolute; top:0; left:0;}
    myns\:bg1 { background:rgb(80%,80%,80%); z-index:1;}
    myns\:bg2 { background:rgb(0%,80%,80%); z-index:2;}
    }
    </style>
    <head>
    </head>

    <body>
    <!-- Since 2 colors, the same text appears twice, with the tags in
    different spots -->
    <myns:thetext>
    <myns:bg1>This sentence has two sections with</myns:bg1> nonwhite
    backgrounds.
    </myns:thetext>
    <myns:thetext>
    This sentence has two <myns:bg2>sections with nonwhite</myns:bg2>
    backgrounds.
    </myns:thetext>
    </body>

    </html>
    Roy, Jul 31, 2004
    #1
    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. F. GEIGER
    Replies:
    3
    Views:
    756
    F. GEIGER
    Aug 6, 2004
  2. Replies:
    2
    Views:
    289
  3. glaszlo
    Replies:
    0
    Views:
    908
    glaszlo
    Jun 5, 2011
  4. Bina Desai
    Replies:
    1
    Views:
    146
    Ray at
    Oct 10, 2003
  5. DrKen
    Replies:
    3
    Views:
    339
    Denis McMahon
    Jul 19, 2011
Loading...

Share This Page