Choosing the Right Alignment for Your Selection Box

How can I adjust the alignment of the select box to make it inline with the others? I also need to apply this alignment to the three option input boxes.

CSS:

#newwebsiteSection, #websiteredevelopmentSection, #otherSection{
    display:none;
}
#newwebsiteForm form{
    padding:10px;
    margin:10px 0;
    width:480px;
    position: relative;
}
#newwebsiteForm label{
    display:block;
    float:left;
    clear:both;
    margin:0 15px 0 25px;
    width:240px;
    border:1px solid green;
}
#newwebsiteForm input{
    display:block;
    float:left;
    width:240px;
    height:15px;
}
#newwebsiteForm .radioButton {
    width:15px;
    height:15px;
}
#newwebsiteForm .radioText {
    display:block;
    width:30px;
    height:20px;
    float:left;
    font-size:12px;
    border:1px solid red;
}

#newwebsiteForm select{
    margin-left:123px;
}

#newwebsiteForm #color1,#color2,#color3,#fav1,#fav2,#fav3{
    display:block;
    float:left;
    margin-left:25px;
    background-color:red;
}

#newwebsiteForm textarea{
    display:block;
    float:left;
}

HTML:

        <section id="content">
            <h1>Free Quote</h1>
                <p>Please complete the questionnaire below for a free quote on web development.</p>
                    <form action="#" method="post">
                        <select name="requiredOption" id="requiredOption">
                            <option id="pleaseselect" value="pleaseselect">Please Choose Your Desired Quote</option>
                            <option id="newwebsite" value="newwebsite">New Website</option>
                            <option id="websiteredevelopment" value="websiteredevelopment">Website Redevelopment</option>
                            <option id="other" value="other">Other</option>
                        </select>
                    </form>
                    <div id="newwebsiteSection">
                        <form action="#" id="newwebsiteForm" method="get">
                        <fieldset>  
                        <label>Do You Need Hosting?</label>
                            <span class="radioText">Yes</span><input class="radioButton" type="radio" name="Yes" value="Yes"/>
                            <span class="radioText">No</span><input  class="radioButton" type="radio" name="No" value="No"/>

                        <label>Do You Need A Domain?</label>
                            <span class="radioText">Yes</span><input class="radioButton" type="radio" name="Yes" value="Yes"/>
                            <span class="radioText">No</span><input class="radioButton" type="radio" name="No" value="No"/>

                        <label>Do You Have A Logo?</label>
                            <span class="radioText">Yes</span><input class="radioButton" type="radio" name="Yes" value="Yes"/>
                            <span class="radioText">No</span><input class="radioButton" type="radio" name="No" value="No"/>

                        <label for="domain">What is your Domain?</label>
                        <input type="url" id="domain" value="http://example.com"/>

                        <label for="newwebsiteType">Type of Site Needed?</label>
                            <select name="newwebsiteType" id="newwebsiteType">
                            <option value="shoppingCart">Shopping Cart</option>
                            <option value="CMS">Content Management System</option>
                            <option value="static">Static Website</option>
                            <option value="otherDevelopment">Other Development</option>
                        </select>

                        <label>Do You Want a Design?</label>
                            <span class="radioText">Yes</span><input class="radioButton" type="radio" name="Yes" value="Yes"/>
                            <span class="radioText">No</span><input class="radioButton" type="radio" name="No" value="No"/>

                        <label>Pick Three Favorite Colors:</label>
                            <input id="color1" value=""/>
                            <input id="color2" value=""/>
                            <input id="color3" value=""/>

                            <label>Share Your Favorite Websites:</label>
                            <input type="text" id="fav1" value=""/>
                            <input type="text" id="fav2" value=""/>
                            <input type="text" id="fav3" value=""/>

                        <label for="comments">Any Comments?</label>
                        <textarea name="comments" id="comments"></textarea>

                        <input type="submit" name="submit" value="Request Quote"/>
                        </fieldset>
                        </form>
                    </div>
                        <div id="websiteredevelopmentSection">
                            <p>Website Redevelopment</p>
                        </div>
                            <div id="otherSection">
                                <p>Other</p>
                            </div>

</section>

Answer №1

Your CSS form selector needs correcting.

#newwebsiteForm{}

I made some adjustments to your HTML and CSS for this layout:

HTML - Wrap label/input pairs in a div. This makes styling much easier. I wrapped Hosting and Domain pairs so that they display on separate lines in IE7.

<div>
    <label>Do You Need Hosting?</label>
    <span class="radioText">Yes</span>
    <input class="radioButton" type="radio" name="Hosting" value="Yes"/>
    <span class="radioText">No</span>
    <input  class="radioButton" type="radio" name="Hosting" value="No"/>
</div>
<div>
    <label>Do You Need A Domain?</label>
    <span class="radioText">Yes</span>
    <input class="radioButton" type="radio" name="Domain" value="Yes"/>
    <span class="radioText">No</span>
    <input class="radioButton" type="radio" name="Domain" value="No"/>
</div>

The .form-field class helps align the inputs. Another wrapper aids formatting in IE7.

<div>
    <label>Top Three Colors?</label>
    <div class="form-field">
        <input id="color1" value=""/>
        <input id="color2" value=""/>
        <input id="color3" value=""/>
    </div>
</div>
<div>
    <label>Favorite Websites?</label>
    <div class="form-field">
        <input type="text" id="fav1" value=""/>
        <input type="text" id="fav2" value=""/>
        <input type="text" id="fav3" value=""/>
    </div>    
</div>

CSS

#newwebsiteForm label{
    height:15px
}
#newwebsiteForm select{
    /*margin-left:123px*/
}
input#domain,
#newwebsiteForm select,
.form-field{float:right;width:200px;margin-top:-15px}

.form-field{width:220px}

See a demo here: http://jsfiddle.net/mjcookson/GTd9J/

Cheers :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The complete height of the website is concealed by the mobile toolbar/menu

I encountered a perplexing issue regarding the responsive resizing of a website on mobile devices. The problem arises when the full height extends over the toolbar/menu, unless the user manually hides the toolbar. Is there a way to dynamically resize the ...

The Django server fails to display the CSS files upon activation

Despite having all the static files in place, only the plain HTML loads without any styles for some unknown reason. I've attempted using collectstatic and even setting up a new project, but to no avail. STATIC_URL is also properly specified along with ...

The outcome of the Python web crawling did not meet our expectations

After using Selenium to scrape web data, I encountered an issue where it only displayed 96 out of 346 products instead of the expected 346. Does anyone have suggestions on how to fix this problem? The crawling code is placed right after the loop for clicki ...

Vue.js component still not transitioning out despite using mode="out-in"

As I navigate my way through learning about vue.js, one issue that has been puzzling me is how to make routed pages fade in and out when a user switches to a new page. Despite thinking it would be a simple task with vue, I have been struggling quite a bit ...

Comprehending the importance of a selector in a dropdown menu

Trying to figure out how to create a drop-down menu from CSS tricks, I found this code snippet: <nav role="navigation"> <ul> <li><a href="#">One</a></li> <li><a href="#"&g ...

The dropdown menu vanishes from sight as soon as the cursor moves away from a link

Recently, I encountered an issue while trying to create a dropdown menu using Jquery. The problem arose when attempting to select the second link, as the entire menu would disappear. Additionally, is there a way to ensure that only one dropdown menu is vis ...

Error encountered in loop for concatenating html elements: identifier unexpectedly found (jquery + html + php)

I am attempting to concatenate HTML inside a variable within a loop and then return it populated. However, I am encountering an error: Uncaught SyntaxError: Unexpected token += in my code. <a style="cursor: pointer" id="addmore">More Entree ?</ ...

Does material-ui work well with forms?

While working with React and material-ui to create a form, I noticed that several components like 'SelectField' did not have a 'name' property. This required me to retrieve the value using a different method. Is material-ui appropriate ...

Unfortunately, CSS3 PIE is not compatible with border-radius and box-shadow properties

I created a basic HTML/CSS code for testing purposes, but I'm having trouble getting the library to function properly. I've placed the .htc, .php and .js files in the same directory as index.html, but it just won't work. Check out the code ...

XML, XTL, and HyperText Markup Language (HTML)

I am facing a challenge with transforming a list in an XML file into an HTML view using XSLT. The nesting of the lists is causing issues and the output is not meeting my requirements. XML: <book-part> <list id="ch4list2" list-type="simple"> & ...

Tips for choosing the right element in CSS

Can someone help me with this issue? https://i.stack.imgur.com/pBu1w.png I've tried setting a CSS selector, but it doesn't seem to be working as expected. What could be causing the selector to not work properly? Any suggestions on how I can f ...

What is the option for receiving automatic suggestions while formatting components in a react.js file?

When styling elements in our app using app.css or styles.css, VS Code provides auto-suggestions. For example, if we type just "back" for background color, it will suggest completions. However, this feature does not work in react.js or index.js. Why is that ...

Is there a way to automatically send users to a different PHP file once they click "submit"?

I need to redirect to a different php file named index2.php. The username and password values are already set as follows: Username=sid, Password=yeaoklogin. When the user clicks on the Login button, they should be redirected to a page called index2.php. ...

Clicking on components that are stacked on top of each

I am facing an issue with two React arrow function components stacked on top of each other using absolute positioning. Both components have onClick attributes, but I want only the one on top to be clickable. Is there a workaround for this? Here is a simpl ...

Having trouble with jQuery loading for the first time

I am having trouble getting the jQuery to load properly. My goal is to toggle classes on specific items identified by their ID. When an item is clicked, I want it to have the class "menu-selected" while the other item has the class "unselected." I have i ...

Background image in Bootstrap not covering entire web page

I am facing an issue where the background image is confined within the constraints of the login panel, and I'm unsure why. My goal is for the image to span the full width and height of the browser window. Any assistance on this matter would be greatly ...

Disable the ability to close the dialog box by clicking

this is my dialog <div *ngIf="visible" class="overlay" (click)="close()"> <div role="dialog" class="overlay-content"> <div class="modal-dialog" (click)="$event.stopPropagation()"> <!-- Modal content--> ...

What is the correct method of implementing the "OnChange" event to a WooCommerce select element?

My task is to include the onchange="myFunction()" in the select menu below. However, because the select menu is part of woocommerce, I want to ensure that the onchange="myFunction()" remains intact even after updating my theme. How can I achieve this goal ...

Tips for identifying the clicked location inside an element using JavaScript?

Is there a way in JavaScript to find out the exact position of a click within an element, like its distance from the left, right, or center? I'm struggling to determine whether the clicked area is on the left, center, or right side. https://i.stack.i ...

CSS - What's the source of this mysterious whitespace?

I'm currently making adjustments to a Wordpress website that is designed to be responsive. The site uses media queries to adapt its display based on the user's screen size, and everything looks great except for when the screen width is at its sma ...