100% wide links

Discussion in 'HTML' started by Jeff, Jan 26, 2008.

  1. Jeff

    Jeff Guest

    I'd like to specify the width of a link. (This would be for a menu).

    You can do this easily in quirks mode but I'm having trouble in
    standards mode.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

    <div style="width: 400px;border: 1px solid black">
    <a href="" style="width: 100%;background-color: green">should go 100%</a>
    </div>

    What's the trick? The end desired result is to do this using lists,
    I've shown the div as it simplifies the example.

    I think this wraps up my days worth of questions!

    Thanks,
    Jeff
     
    Jeff, Jan 26, 2008
    #1
    1. Advertising

  2. Jeff wrote:
    > I'd like to specify the width of a link. (This would be for a menu).
    >
    > You can do this easily in quirks mode but I'm having trouble in
    > standards mode.
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    >
    > <div style="width: 400px;border: 1px solid black">
    > <a href="" style="width: 100%;background-color: green">should go 100%</a>
    > </div>
    >
    > What's the trick? The end desired result is to do this using lists,
    > I've shown the div as it simplifies the example.


    What you have won't work because A elements are inline elements and do
    not have a width property. What you can do is make it display as block
    then it would have a width.

    <a style="display: block; ...

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jan 27, 2008
    #2
    1. Advertising

  3. Jeff

    dorayme Guest

    In article <>,
    Jeff <jeff@spam_me_not.com> wrote:

    > I'd like to specify the width of a link. (This would be for a menu).
    >
    > You can do this easily in quirks mode but I'm having trouble in
    > standards mode.
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    >
    > <div style="width: 400px;border: 1px solid black">
    > <a href="" style="width: 100%;background-color: green">should go 100%</a>
    > </div>
    >
    > What's the trick? The end desired result is to do this using lists,
    > I've shown the div as it simplifies the example.
    >


    Add display: block; to the style for the anchor.

    --
    dorayme
     
    dorayme, Jan 27, 2008
    #3
  4. Jeff

    Jeff Guest

    Jonathan N. Little wrote:
    > Jeff wrote:
    >> I'd like to specify the width of a link. (This would be for a menu).
    >>
    >> You can do this easily in quirks mode but I'm having trouble in
    >> standards mode.
    >>
    >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    >> "http://www.w3.org/TR/html4/strict.dtd">
    >>
    >> <div style="width: 400px;border: 1px solid black">
    >> <a href="" style="width: 100%;background-color: green">should go 100%</a>
    >> </div>
    >>
    >> What's the trick? The end desired result is to do this using lists,
    >> I've shown the div as it simplifies the example.

    >
    > What you have won't work because A elements are inline elements and do
    > not have a width property. What you can do is make it display as block
    > then it would have a width.
    >
    > <a style="display: block; ...


    Thanks to you and dorayme. About an hour after I wrote this, as I was
    driving down the road, that ocured to me.

    Jeff
    >
     
    Jeff, Jan 27, 2008
    #4
  5. Jeff

    Bergamot Guest

    Jeff wrote:
    > I'd like to specify the width of a link. (This would be for a menu).
    >
    > <div style="width: 400px;border: 1px solid black">
    > <a href="" style="width: 100%;background-color: green">should go 100%</a>
    > </div>


    For navigation menus div is out, lists are in.
    http://css.maxdesign.com.au/listamatic/

    --
    Berg
     
    Bergamot, Jan 28, 2008
    #5
    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. Web Developer

    char 8bit wide or 7bit wide in c++?

    Web Developer, Jul 31, 2003, in forum: C++
    Replies:
    2
    Views:
    587
    John Harrison
    Jul 31, 2003
  2. Disc Magnet
    Replies:
    2
    Views:
    716
    Jukka K. Korpela
    May 15, 2010
  3. Disc Magnet
    Replies:
    2
    Views:
    791
    Neredbojias
    May 14, 2010
  4. fred
    Replies:
    3
    Views:
    283
    Zifud
    Mar 17, 2005
  5. Replies:
    5
    Views:
    890
Loading...

Share This Page