SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast ParfaitMacaron's Avatar
    Join Date
    Mar 2013
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drop Down Box Problem

    Hi,

    I'm trying to create a drop down option box but it is not formatting right in the CSS. I am using this CSS template

    Instead of lining up side by side like this

    FIELD [ BOX ]

    It is doing this...where on the first line the option box goes side by side with the first field the user needs to enter.

    FIELD [ BOX ] [ BOX ]

    FIELD [ BOX ]

    FIELD [ BOX ]

    FIELD [ BOX ]

    FIELD [ BOX ]

    FIELD [ BOX ]

    FIELD

    My HTML code is as follows:

    Code:
    <select name="dropdown">
    				<option value="Choice 1">1</option>
    				<option value="Choice 2">2</option>
    				<option value="Choice 3">3</option>
    				</select>
    I have a suspicion it is because there isn't any CSS for a dropdown box type. If this is the case, how would I align it correctly please? Thank you!

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    It's a little hard to understand what you are describing here, but I can only assume that some of your elements are floated and are floating to positions where you don't want them. If so, this will be a CSS issue. Please either post a link to a working example, or post your page code here so we can test it out.

  3. #3
    SitePoint Enthusiast ParfaitMacaron's Avatar
    Join Date
    Mar 2013
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    It's a little hard to understand what you are describing here, but I can only assume that some of your elements are floated and are floating to positions where you don't want them. If so, this will be a CSS issue. Please either post a link to a working example, or post your page code here so we can test it out.
    Thanks for your reply.

    Here is my CSS code:

    Code:
    body{
    font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
    font-size:12px;
    }
    p, h1, form, button{border:0; margin:0; padding:0;}
    .spacer{clear:both; height:1px;}
    /* ----------- My Form ----------- */
    .myform{
    margin:0 auto;
    width:400px;
    padding:14px;
    }
    
    /* ----------- stylized ----------- */
    #stylized{
    border:solid 2px #b7ddf2;
    background:#ebf4fb;
    }
    #stylized h1 {
    font-size:14px;
    font-weight:bold;
    margin-bottom:8px;
    }
    #stylized p{
    font-size:11px;
    color:#666666;
    margin-bottom:20px;
    border-bottom:solid 1px #b7ddf2;
    padding-bottom:10px;
    }
    #stylized label{
    display:block;
    font-weight:bold;
    text-align:right;
    width:140px;
    float:left;
    }
    #stylized .small{
    color:#666666;
    display:block;
    font-size:11px;
    font-weight:normal;
    text-align:right;
    width:140px;
    }
    #stylized input{
    float:left;
    font-size:12px;
    padding:4px 2px;
    border:solid 1px #aacfe4;
    width:200px;
    margin:2px 0 20px 10px;
    }
    #stylized button{
    clear:both;
    margin-left:150px;
    width:125px;
    height:31px;
    background:#666666 url(img/button.png) no-repeat;
    text-align:center;
    line-height:31px;
    color:#FFFFFF;
    font-size:11px;
    font-weight:bold;
    }
    And the HTML for dropdown box:

    Code:
    <div id="stylized" class="myform">
    <form id="form" name="form" method="post" action="index.html">
    <h1>Sign-up form</h1>
    <p>This is the basic look of my form without table</p>
    
    <label>Name
    <span class="small">Add your name</span>
    </label>
    <input type="text" name="name" id="name" />
    
    <label>Email
    <span class="small">Add a valid address</span>
    </label>
    <input type="text" name="email" id="email" />
    
    <label>Password
    <span class="small">Min. size 6 chars</span>
    </label>
    <input type="text" name="password" id="password" />
    
    <label>User Type
    <span class="small">Select</span>
    </label>
    <select name="dropdown">
    <option value="Choice 1">1</option>
    <option value="Choice 2">2</option>
    <option value="Choice 3">3</option>
    </select>
    
    <button type="submit">Sign-up</button>
    <div class="spacer"></div>
    
    </form>
    </div>

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Lots of ways you can deal with that, but perhaps the easiest is

    Code:
    select {
      float: left;
      margin-left: 10px;
    }

  5. #5
    SitePoint Enthusiast ParfaitMacaron's Avatar
    Join Date
    Mar 2013
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you!


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
  •