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 trialMichael Caveney
50,144 PointsFlexbox/Registration Form
I'm having trouble getting the checkboxes and radio buttons on the desktop view of this to look right......I can't quite get the styling to stick to the various labels as needed. I have this perfect on mobile view, but I haven't figured out how to target the radio and checkbox elements with the desired styling that doesn't contradict the other label/input pairings. The code:
<!doctype html>
<head>
<meta charset="utf-8">
<title>Code Review Newsletter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Merriweather|Open+Sans" rel="stylesheet">
</head>
<body>
<div class="main-content">
<div class="header">
<h1>The Code Review</h1>
</div>
<h1>Signup for our newsletter</h1>
<p>Get the latest news on how your code is doing right in your inbox</p>
<hr>
<hr>
<form action="#" method="post">
<fieldset>
<legend><strong>Contact Information</strong></legend>
<div class="input">
<label for="first">First Name</label>
<input type="text" id="first" name="first" placeholder="required"/>
</div>
<div class="input">
<label for="last">Last Name</label>
<input type="text" id="last" name="last" placeholder="required"/>
</div>
<div class="input">
<label for="phone">Phone Number</label>
<input type="tel" id="phone" name="phone" placeholder="9 digit format, no dashes"/>
</div>
<div class="input">
<label for="address">Street Address</label>
<input type="text" id="address" name="address" />
</div>
<div class="input">
<label for="city">City</label>
<input type="text" id="city" name="city" />
</div>
<div class="input">
<label for="state">State</label>
<select id="state" name="state">
<option value="choose" selected>Choose State</option>
<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>
</select>
</div>
<div class="input">
<label for="zip">Zip Code</label>
<input type="number" id="zip" name="zip" />
</div>
</fieldset>
<hr>
<fieldset>
<legend><strong>Newsletter</strong></legend>
<p class="select">Select the newsletters you would like to receive</p>value="second_checkbox"> CSS News</label>
</div>
<div class="checkbox">
<label for="cbox3" class="lower"><input type="checkbox" id="cbox3" value="third_checkbox"> Javascript News</label>
</div>
</div>
<p class="news">Newsletter format</p>
<div class="radioinput">
<input type="radio" name="format" id="html" value="HTML" checked> <label for="html" class="radio">HTML</label>
</div>
<div class="radioinput">
<input type="radio" name="format" id="plaintext" value="Plain Text"> <label for="plaintext" class="radio">Plain Text</label>
</div>
<div class="input">
<p class="news">Other options you'd like to hear about</p>
<textarea></textarea>
</div>
<div class="input">
<label for="refer">How did you hear about us?</label>
<select id="refer" name="refer">
<option value="TC">Techcrunch</option>
<option value="GI">Gizmodo</option>
<option value="TH">Treehouse</option>
<option value="CS">Code School</option>
<option value="OT">Other</option>
</select>
</div>
</fieldset>
<button type="submit">Sign Up</button>
<p class="last">Copyright The Code Review</p>
</form>
</div>
</body>
</html>
And the CSS:
html {
font-family: 'Open Sans', sans-serif;
text-align: center;
}
button {
background-color: #00ace6;
border: none;
border-radius: 4px;
color: white;
display: inline-block;
margin-top: 1%;
max-width: 95%;
padding: 16px 65px;
}
fieldset {
border: 0 none;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.main-content {
margin: 0 auto;
max-width: 90%;
}
h1, button, legend {
font-family: 'Merriweather', serif;
}
input[type=text], input[type=number], input[type=tel], textarea, select {
border-radius: 4px;
background-color: #e0e0d1;
max-width: 95%;
transition: background-color 2s;
}
input[type=text]:focus, input[type=number]:focus, input[type=tel]:focus, textarea:focus, select:focus{
background-color: white;
}
label {
display: block;
margin-top: 1%;
margin-bottom: 1%;
text-align: left;
}
legend {
text-align: left;
}
select {
margin-top: 1%;
}
.header {
background-color: black;
}
.header h1 {
color: white;
}
.input {
display: flex;
flex-direction: column;
justify-content: flex-start;
flex: 1;
margin-top: 1%;
margin-bottom: 1%;
}
.last {
margin-bottom: 1%;
}
.main-content {
background-color: white;
margin: 0 auto;
max-width: 90%;
}
.radio {
display: inline;
}
.radioinput, .news {
text-align: left;
}
::-webkit-input-placeholder {
font-style: italic;
font-family: 'Open Sans', sans-serif;
text-align: right;
}
@media screen and (min-width: 1024px) {
input, select {
width: 66%;
}
label {
text-align: right;
width: 33%;
}
.lower {
display: flex;
flex-direction: column;
justify-content: flex-start;
margin-top: 1%;
margin-bottom: 1%;
text-align: left;
}
.checkbox {
flex: 1;
}
.select, .news {
text-align: left;
}
.input {
flex-direction: row;
justify-content: space-between;
}
.main-content {
max-width: 45%;
}
.radioinput {
display: flex;
}
}
Michael Caveney
50,144 PointsWhoops! Reposting with proper markdown.
Michael Caveney
50,144 PointsSolved, what it took was the painfully obivous use of specfic input "type" selectors versus the general input selector.
tylerpostuma2
5,175 Pointstylerpostuma2
5,175 PointsHello! Could you maybe link us to your workspace? The code on the page is a bit hard to read!