SA Developer .NET

Welcome to SA Developer .NET Sign in | Join | Help
in Search

Wrapping text in html option tag

Last post 07-16-2008, 14:37 by HanneSThEGreaT. 8 replies.
Sort Posts: Previous Next
  •  05-13-2008, 11:43 12062

    Wrapping text in html option tag

    Hi there,

    Is there any way I can wrap the text in the Html <option> tag to using a stylesheet? I need to try and do this in the simplest way possible as I do not have access to an app's source code and it has to be re-branded.

     

    Thanks, 


    The Question is the Answer, and the Answer is the Question!
  •  05-13-2008, 13:04 12065 in reply to 12062

    Re: Wrapping text in html option tag

    why dont you try adding a new css class to your stylesheet and defining it with the option tag?

    eg:

    .myclass option
    {
    background: #cccccc;
    }


    SA Developer .Net Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  •  05-13-2008, 13:09 12066 in reply to 12065

    Re: Wrapping text in html option tag

    That I understand.

    But can I use a CSS property to allow for all the option tags' text to be wrapped?

     

    Thanks, 


    The Question is the Answer, and the Answer is the Question!
  •  05-13-2008, 13:15 12067 in reply to 12066

    Re: Wrapping text in html option tag

    horatio:

    That I understand.

    But can I use a CSS property to allow for all the option tags' text to be wrapped?

     

    Thanks, 

    As far as I know the answer to that is no...  Sad


    "I would love to change the world, but they won't give me the source code"
    Meeting Place - chat online with anyone, anytime, no downloads or plugins required
  •  05-13-2008, 13:15 12068 in reply to 12066

    Re: Wrapping text in html option tag

    I hope I am on the right track -

     eg:

    option
    {
    background: #cccccc;
    }


    SA Developer .Net Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  •  05-13-2008, 14:25 12070 in reply to 12068

    Re: Wrapping text in html option tag

    I don't think you are.

     I think the OP wants to know how to keep the option elements fixed width, and to wrap long options texts onto two or more lines, instead of having a screen wide drop-down.  Setting a background colour just doesn't do that. Confused


    Unscrambling Eggs: Decompiling ASP.NET
  •  05-27-2008, 8:52 12372 in reply to 12066

    Re: Wrapping text in html option tag

    horatio:

    That I understand.

    But can I use a CSS property to allow for all the option tags' text to be wrapped?

    Thanks, 

    Sorry about the background exmaple, not sure where my mind was... How about this below -

    .myclass option
    {
    text-wrap: normal OR suppress;
    }


    SA Developer .Net Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  •  07-15-2008, 17:52 13390 in reply to 12372

    Re: Wrapping text in html option tag

    you can wrap text with css? Tongue Tied

    wow, i've been hiding


    I'm going to regret forging this...
  •  07-16-2008, 14:37 13410 in reply to 13390

    Re: Wrapping text in html option tag

    CSS and pure HTML cannot do this on their own.

    The only way possible, is to create your own type of SELECT through JavaScript code.  This means, that you make a drop down type of menu with JS.

    I know what you're thinking, your'e thinking NO, hell No! This will not look & function the same. It will, because, you can make it act as a normal SELECT drop down - it's just a bit more versatile, and looks nicer IMHO :)

     Now, to the point.

    Some time ago, I stumbled upon this very same issue, and after days of googling, I stumbled accross this amazing tutorial: http://www.devarticles.com/c/a/Web-Style-Sheets/Taming-the-Select/

    What I did for you now, is to to just add all the missing pieces together, and add the wrapping capabilities :D

    It works, I promise!

    If you want it, just send me an email, or PM with your email, and I'll gladly send it to you :)

    Or, tell me how to attach code here

     


    It's Not Answers That Change The World, It's Questions
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems