Solved

CSS dropdown select option:  styling WITHIN option text

Posted on 2015-01-06
3
260 Views
Last Modified: 2015-01-06
i've found several CSS schemes that work for styling an HTML FORM dropdown menu
so that it uses a nice font and overall stylings.

However, for this project,  the option text label content has three components (columns)  that really could use some graphic delineation,
such as tab-like alignments ("columns") or at least  Bold and/or Color changes    in order to appear
somewhat organized and more readable.

For instance, here's a sample option label content:

6'x9'           FREE SHIPPING    -        US$587.00
7'6"x9'6"           FREE SHIPPING    -        US$778.00
8'x10'           FREE SHIPPING    -        US$873.00
18'6"x24'8"           SHIPPING CHARGES APPLY    -        US$1959.00

Even with several tries of CSS stylings found on the web,  there seems no way to align, etc.

it's database-generated (which in itself is no problem), (and easy to apply divs/spans/classes)
but i'm looking for some technique to apply a tidy formatting scheme.

I suppose i could revert to some sort of a flyout radio button scheme that collapses once selected, and
then the text could be aligned with CSS classes.  (but seems awfully awkward)

any thoughts/suggestions?

thanks!
0
Comment
Question by:willsherwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 250 total points
ID: 40534823
you can't style select elements to that degree. So what people end up doing is scripting a solution which replaces the select dropdown with a list (ul), which can be styled to your heart's content. There are javascript libraries out there that simplify this.

Personally I would just use a ul to begin with, and forget about the select drop-down. You will need to pass the values to your form through javascript. There are a number of different ways to do that depending on how you are submitting the form.
0
 
LVL 4

Assisted Solution

by:Tom Chadaravicius
Tom Chadaravicius earned 250 total points
ID: 40534860
1. To second and augment what Kyle has said, you can have more freedom to style the surrounding element than the stubborn one ("text" appears stubborn.) I use <div> preceding text to accomplish that.
There may not be ul around the text but there's going to be <div> and body - the latter for sure.
2. All elements get set up in the "bootstrap" portion of the CSS - the very top of the first sheet.
input[type=text]{ (your style here) }
Chrome is especially sensible to that (but Chrome also has a quite extensive "Inspect Element" option to track where the style of an element is defined.)
0
 

Author Closing Comment

by:willsherwood
ID: 40534872
based on your excellent comments, i was able to search in this new direction and found this solution:
http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx

thank you!
1

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using Specialized Fonts in CSS 1 61
Responsive Font Size 6 65
Fix a css menu for width 15 40
bootstrap wrap text 1 57
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question