Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Jeriah Bowers
.a{fill-rule:evenodd;}techdegree seal-36
Jeriah Bowers
Front End Web Development Techdegree Graduate 20,590 Points

Label and Input on same line

Hi there, So I'm trying to get the label and input elements in my markup on the same line. I actually achieved this in the mobile viewport for my radio and checkbox inputs but tried using that same method for the rest at the 768px breakpoint and it didn't work can you help me out??

<!DOCTYPE html>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Sign Up Form</title>
        <link rel="stylesheet" href="css/main.css">
        <link href="https://fonts.googleapis.com/css?family=Playfair+Display" rel="stylesheet">
       <h1 id="title">The Code Review</h1>
        <div id="wrapper">
            <h2>Signup for our newsletter</h2>
            <p>Get the latest news on how your code is doing right in your inbox.</p>
          </header> <!-End Main Header-->
        <hr class="tp">
        <hr class="bt">
        <h2 id="formTitle">Contact Information</h2>   
        <form action="index.html" method="POST">
            <label for="name">Full Name</label>
            <input type="text" id="name" name="user_name" placeholder="Required">

            <label for="email">Email Address</label>
            <input type="email" id="email" name="user_email" placeholder="Required">

            <label for="phone">Phone Number</label>
            <input type="tel" id="phone" name="user_phone">

            <label for="address">Street Address</label>
            <input type="text" id="address" name="user_address">

            <label for="city">City</label>
            <input type="text" id="city" name="user_city">

            <label for="state">State</label>
            <select id="state" name="user_state">
                <option value="AL">Alabama</option>
                <option value="AK">Alaska</option>
                <option value="AZ">Arizona</option>
                <option value="AR">Arkansas</option>
                <option value="CA">California</option>
                <option value="CO">Colorado</option>
                <option value="CT">Connecticut</option>
                <option value="DE">Delaware</option>
                <option value="DC">District of Columbia</option>
                <option value="FL">Florida</option>
                <option value="GA">Georgia</option>
                <option value="HI">Hawaii</option>
                <option value="ID">Idaho</option>
                <option value="IL">Illinois</option>
                <option value="IN">Indiana</option>
                <option value="IA">Iowa</option>
                <option value="KS">Kansas</option>
                <option value="KY">Kentucky</option>
                <option value="LA">Louisiana</option>
                <option value="ME">Maine</option>
                <option value="MD">Maryland</option>
                <option value="MA">Massachusetts</option>
                <option value="MI">Michigan</option>
                <option value="MN">Minnesota</option>
                <option value="MS">Mississippi</option>
                <option value="MO">Missouri</option>
                <option value="MT">Montana</option>
                <option value="NE">Nebraska</option>
                <option value="NV">Nevada</option>
                <option value="NH">New Hampshire</option>
                <option value="NJ">New Jersey</option>
                <option value="NM">New Mexico</option>
                <option value="NY">New York</option>
                <option value="NC">North Carolina</option>
                <option value="ND">North Dakota</option>
                <option value="OH">Ohio</option>
                <option value="OK">Oklahoma</option>
                <option value="OR">Oregon</option>
                <option value="PA">Pennsylvania</option>
                <option value="RI">Rhode Island</option>
                <option value="SC">South Carolina</option>
                <option value="SD">South Dakota</option>
                <option value="TN">Tennessee</option>
                <option value="TX">Texas</option>
                <option value="UT">Utah</option>
                <option value="VT">Vermont</option>
                <option value="VA">Virginia</option>
                <option value="WA">Washington</option>
                <option value="WV">West Virginia</option>
                <option value="WI">Wisconsin</option>
                <option value="WY">Wyoming</option>

            <label for="zipcode">Zip Code</label>
            <input type="text" id="zipcode" name="user_zip">

            <p>Select the newsletters you would like to recieve.</p>

            <input type="checkbox" id="htmlNews" name="html_news"><label for="htmlNews" class="inline">HTML News</label><br>
            <input type="checkbox" id="cssNews" name="css_news"><label for="cssNews" class="inline">CSS News</label><br>
            <input type="checkbox" id="jsNews" name="js_news"><label for="jsNews" class="inline">JavaScript News</label><br>

            <p>Newsletter format</p>

            <input type="radio" id="html" name="html"><label for="html" class="inline">HTML</label><br>
            <input type="radio" id="plainText" name="html"><label for="plainText" class="inline">Plain Text</label><br>

            <label for="topics" id="top">Other topics you'd like to hear about.</label>
            <textarea id="topics" name="other_topics"></textarea>

            <button type="submit">Sign Up</button>
            <span>Copyright The Code Review</span>
    </div> <!--end wrapper div-->

And here is the CSS

/*Base Styles*/

form input, form select, form textarea {
    display: block;

body {
    margin: 0;
    background-color: #fcfcfc;
    font-family: 'Playfair Display', serif;

#wrapper {
    max-width: 94%;
    margin: auto;

h2 {
    font-size: 1.8em;

p {
    font-size: 1.2em;

/*Header Styles*/

#title {
    margin: 0;
    padding: .5em;
    text-align: center;
    color: white;
    background: #4c5059;

header {
    text-align: center;

header h2 {
    margin-bottom: -10px;

hr {
   border: 1px solid black;
   width: 95%;

.tp {
    border: 3px solid black;

/*Form Styling*/

*, *:before, *:after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;

select {
  background: rgba(255,255,255,0.1);
  border: none;
  font-size: 16px;
  height: auto;
  margin: 0;
  outline: 0;
  padding: 15px;
  width: 100%;
  background-color: #f2f2f2;
  color: #999999;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
  margin-bottom: 30px;
  border-radius: 5px;

label {
    display: inline-block;
    margin-bottom: 1em;
    color: #848484;

label.inline, input[type="checkbox"], input[type="radio"] {
    display: inline;
    margin-bottom: 1em;

button {
    padding: 20px;
    width: 100%;
    border-radius: 5px;
    font-size: 1.3em;
    color: white;
    background-color: #7bc4a4;

textarea {
    height: 100px;

select {
    height: 50px;

form {
    margin-bottom: 12em;

span {
    display: block;
    font-style: italic;
    text-align: center;
    margin-top: 17px;
    color: #a7aaa9;

#top {
    margin-top: .9em

input[type="checkbox"] {
    margin-right: 1em;

#zipcode {
    width: 50%;

input::-webkit-input-placeholder {
  color: #999999;
  font-style: italic;
  text-align: right;

input:focus {
     border: 2px solid darkgray;

/*Media Query*/

@media (min-width: 768px) {

    #wrapper {
        max-width: 60%;

    hr {
        width: 100%;

    header {
        max-width: 90%;
        margin: auto;

    input, select {
       max-width: 60%;

    label, input, select  {
        display: inline;


Thank you in advance.

1 Answer

Ryan S
Ryan S
27,276 Points

Hi Jeriah,

I think the issue is due to specificity. On line 3 in main.css you are targeting form input and setting the display to block, but in your media query you are just targeting input. The media query will not override the input display value because it has less specificity than line 3. So even though your labels are inline, the input remains block.