Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Seth Ellis
PLUS
Seth Ellis
Courses Plus Student 5,950 Points

Positioning form

Hi! This seems to be a really simple answer but I have been stuck for at least two days trying to figure this one out. I am trying to figure out how to move my form over to the right of my primary-content class.

My HTML is:

<div class="primary-content col">
<h2>A New Year<br>A New YOU</h2>
     <p class="intro">
        This year is about you looking and feeling your best. It's time to look in the mirror and go WOW! Here at Universal fitness with alittle help and guidance will make sure you walk out feeling and looking the best shape of your life. Let us help you get your year started on the right foot. <br> <a href="#">SIGN UP TODAY!</a>
        </p>
     </div>

 <form>
    <fieldset class="secondary-content col"> 
      <label>
        First Name
        <input type="text" name="first-name">
      </label>
      <label>
        Last Name
        <input type="text" name="last-name">
      </label>
      <label>
        Email
        <input type="email" name="email-address">
      </label>
      <label>
        Phone
        <input type="tel" name="phone-number">
      </label>
      </fieldset>
      <fieldset class="account-action">
      <input class="btn" type="submit" name="submit" value="sign-up">
    </fieldset>
 </form>

My CSS code for this is:

@charset "UTF-8";
/* CSS Document */

* {
    box-sizing: border-box;
    }

html,
body,
.wrapper, {
    height: 100%
    }



/* Form
================================*/      


form {
  border: 1px solid #c6c7cc;
  border-radius: 5px;
  font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
  width: 240px;
}


fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

input {
  border-radius: 5px;
  font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin: 0;
}

.secondary-content {
  padding: 20px 20px 0 20px;
}
.secondary-content label {
  color: #395870;
  display: block;
  font-weight: bold;
  margin-bottom: 20px;
}
.secondary-content input {
  background: #fff;
  border: 1px solid #c6c7cc;
   box-shadow: inset 0 1px 1px rgba(0, 0, 0, .1);
  color: #636466;
  padding: 6px;
  margin-top: 6px;
  width: 100%;
}

.secondary-content {
  padding: 20px 20px 0 20px;
}

secondary-content label {
  color: #395870;
  display: block;
  font-weight: bold;
  margin-bottom: 20px;
}
.secondary-content input {
  background: #fff;
  border: 1px solid #c6c7cc;
   box-shadow: inset 0 1px 1px rgba(0, 0, 0, .1);
  color: #636466;
  padding: 6px;
  margin-top: 6px;
  width: 100%;
}
.account-action {
  background: #f0f0f2;
  border-top: 1px solid #c6c7cc;
  padding: 20px;
}
.account-action .btn {
  background: linear-gradient(#49708f, #293f50);
  border: 0;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
  padding: 8px 16px;
}
.account-action label {
  color: #7c7c80;
  font-size: 12px;
  margin: 10px 0 0 20px;
}



/* Column Layout
================================*/  

secondary-content,
primary-content {
    display: inline-block;
    }

.primary-content {
    width: 50%;
    }

.secondary-content {
    width: 40%;
    }

1 Answer

Nejc Vukovic
seal-mask
.a{fill-rule:evenodd;}techdegree
Nejc Vukovic
Full Stack JavaScript Techdegree Student 36,386 Points

Try this:

/* Column Layout
================================*/  

secondary-content,
primary-content {
    display: inline-block;
    }

.primary-content {
    width: 50%;
    float: left;
    margin: 0 2.5%;
    }

.secondary-content {
    width: 40%;
    float: left;
    margin: 0 2.5%;
    }

I added margin to separate the columns a bit.

Hope it helps.