Tell us what’s happening:
Hello, i’m actually working on my first solo project for certification on html and i wanted to have a tips on something i maybe made wrong ? i’m working actualy on css but there is something i don’t get.
i would like to have my input take 100% of his parents ( form → main )
what i’ve done, work on the FreeCodeCamp page but if i read my code with chrome or edge the input textbox go like 3/4 pixel after the main group.
i’ve try to put some color on my code to see every part, i also put a test div with 100% width to see but this do what i expect, only the input is weird.
edit: my css have 2 different part input {} because i was doing some test sorry, in start it was in same group
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Survey Form</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1 id="title">freeCodeCamp Survey Form</h1>
<p id="description">Thank you for taking the time to help us improve the platform</p>
<div class="main">
<div class="test"></div>
<form action="Index.html" id="survey-form">
<label for="name" id="name-label"> Name<input placeholder="Enter your name" type="text" required id="name"></label>
<label for="email" id="email-label"> Email<input type="email" required placeholder="Enter your Email" id="email"></label>
<label for="number" id="number-label"> Age (optional)<input type="number" id="number" min="13" placeholder="Age" max="120"></label>
<label for="dropdown">What is your favorite feature of freeCodeCamp?</label>
<select id="dropdown">
<option value="0" disabled >Select current role</option>
<option value="Student">Student</option>
<option value="Full time job">Full Time Job</option>
<option value="Full time Learner">Full Time Learner</option>
<option value="Prefer not to say">Prefer not to say</option>
<option value="Other">Other</option>
</select>
<fieldset>
<legend>Would you recommend freeCodeCamp to a friend ?</legend>
<label for="Definitely"><input type="radio" value="1" id="Definitely" name="recommend"> Definitely</label>
<label for="recommend"><input type="radio" value="2" id="recommend" name="recommend"> Maybe</label>
</fieldset>
<fieldset>
<legend>What would you like to see improved? (check all that apply)</legend>
<label for="Front-end"><input type="checkbox" value="1" id="Front-end"> Front-end Projects</label>
<label for="Back-end"><input type="checkbox" value="2" id="Back-end"> Back-end Projects</label>
<label for="Data-visualization"><input type="checkbox" value="3" id="Data-visualization"> Data Visualization</label>
</fieldset>
<label for="comments">Any comments or suggestions?</label><textarea name="comments" id="comments" cols="50" rows="10" placeholder="Enter your comment here..."></textarea>
<button id="submit">Submit</button>
</form>
</div>
</body>
</html>
/* file: styles.css */
body{
background-image: linear-gradient(115deg,rgba(58,58,158,0.8),rgba(136,136,206,0.78)),url(https://cdn.freecodecamp.org/testable-projects-fcc/images/survey-form-background.jpeg);
}
.main{
width: 60vw;
height: 100vh;
min-width: 500px;
max-width: 600px;
margin: 0 auto;
background-color: rgba(27,27,50,80%);
color: white;
font-family: "Comic Sans MS";
padding-top: 2em;
padding-left: 2em;
}
input {
background-color: black;
color: grey;
display: block;
margin-bottom: 20px;
}
.test{
background-color: red;
width: 100%;
height: 10px;
}
form{
width: 100%;
background-color: green;
}
input{
width: 100%;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.117
Challenge: Survey Form - Build a Survey Form
Link to the challenge: