Results 1 to 2 of 2

Thread: CSS Apparent width? Or something like that...

  1. #1
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Beans
    186
    Distro
    Ubuntu 8.04 Hardy Heron

    CSS Apparent width? Or something like that...

    Is there any way to change the 'apparent width' of an element. What I mean is, even though the element should have a real width of say X pixels, it should actually not take up that much spacing for the next element.

    Ok, I know I sound confusing, so let's take an example.

    Code:
    <span id="one">Hello</span> <span id="two">World</span>
    This looks like:
    Code:
    Hello World
    However, I want 'World' to be written over 'Hello'. That is, after 'Hello' is printed on the screen, I don't want the browser's 'cursor' to be located at the end of the word, but instead I don't want the 'cursor' to be moved at all. I want the next element to be placed exactly where the previous one was.

    I can achieve this by setting a negative margin to #two...

    Code:
    #two { margin-left: -40px; }
    But then the value of negative margin varies as the width of the previous element. I want a solution where I can do this without knowing the width of the previous element. So I want something that can style #one so that it prints normally but doesnt actually move the browser's 'cursor' ahead.

    Possible?
    http://verminox.wordpress.com - Answers to Life, the Universe and Everything

  2. #2
    Join Date
    Apr 2005
    Location
    Warsaw, Poland
    Beans
    111
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: CSS Apparent width? Or something like that...

    One possible solution is:
    Code:
    #one { position: absolute; }
    You might also experiment with width/float/overflow:
    Code:
    #one { float: left; width: 0px; overflow: visible; }

Bookmarks

Posting Permissions

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