Go Back   Technology Forums > Computer Forums > HTML and CSS

Share your knowledge and questions, related to HTML and CSS in this forum.


CSS Select Box / Border


Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 02-16-2007, 12:39 AM
Administrator
 
Join Date: Dec 2006
Posts: 304
shri has disabled reputation
Default CSS Select Box / Border

Some simple CSS tricks to show you how to change how your select dropdown box (showing select options can be changed)

First, the code ( http://www.devlib.org/samples/select1.html )

Code:
<html>
<head><title>Select Styles</title>
<style>
        table { background: #cccccc; }
        .blackborder { border: 2px solid #000000 }
        .noborder { border: 0px }
        .numbers { background: #dddddd; }
        .alpha { background: #888888; }
</style>
</head>
<body>
        <table width="200" bgcolor="#000000">
        <tr><td>
        <form>
                2 px black border: <select name="abc" class="blackborder">
                        <option value="1">1</option>
                        <option value="2">2</option>
                </select><br>
                No border: <select name="abc" class="noborder">
                        <option value="1">1</option>
                        <option value="2">2</option>
                </select><br>
                Colored Options:
                         <select name="abc" class="coloredoption">
                                <optgroup Label="Numbers" class="numbers">
                                <option value="1">1</option>
                                <option value="2">2</option>
                                </optgroup>
                                <optgroup Label="Alpha" class="alpha">
                                <option value="a">a</option>
                                <option value="b">b</option>
                                </optgroup>
                        </select>
        </form>
        </td></tr></table>
</body>
</html>

We have three select dropdown boxes in this html snippet.

The first one has a 2 pixel black border which is done by this piece of code in the style.

Code:
        .blackborder { border: 2px solid #000000 }
The second select box has no border which is done by this piece of code.

Code:
        .noborder { border: 0px }
Finally, the last select box uses the optgroup tag to create a group, which is then styled with different backgrounds.

Code:
        .numbers { background: #dddddd; }
        .alpha { background: #888888; }
Exceptions are documented below.
Reply With Quote
  #2 (permalink)  
Old 02-16-2007, 12:50 AM
Administrator
 
Join Date: Dec 2006
Posts: 304
shri has disabled reputation
Default

1) The black border does not show up in Internet Explorer -- works ok with firefox and opera.

2) Opera renders the optgroup labels fairly differently from firefox / IE.

IE / Firefox show Numbers and Alpha in Bold Black
Opera shows them in a normal white colored font.
Reply With Quote
Reply





Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer - Slow Rendering of SELECT / OPTION tags shri HTML and CSS 0 02-15-2007 05:09 PM



Advanced Search

All times are GMT -6. The time now is 07:34 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.