Survey Form - Build a Survey Form

Tell us what’s happening:
Describe your issue in detail here.

hello, I just want to know how to make the background-color above the background-photo in css body? the background-image covers the background-color and I want it to make it in the contrary.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Survey Form</title>
    <link rel="stylesheet" href="styles.css">
  </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>
  <form id="survey-form" method="post" action='https://register-demo.freecodecamp.org'>
      <fieldset>
        <section>
          <label for="name" id="name-label">Name<input id="name" type="text" placeholder="Enter your name" required></label>
          <label for="email" id="email-label">Email<input id="email" type="email" placeholder="Enter your email" required></label>
          <label for="number" id="number-label">Age(optional)<input id="number" type="number" placeholder="Enter your age" min="10" max="120"></label>
          <label for="dropdown">Which option best describes your current role?
            <select id="dropdown">
              <option value="">select one</option>
              <option value="1">student</option>
              <option value="2">part time job</option>      
            </select>
          </label>
        </section>
        <section>
          <label class="group">Would you recommend freeCodeCamp to a friend?
            <label for="definitely" ><input id="definitely" type="radio" value="definitely" name="recommendation" class="inline">Definitely</label>
            <label for="maybe" ><input id="maybe" type="radio" name="recommendation" value="maybe" class="inline">Maybe</label>
            <label for="not sure" ><input id="not sure" type="radio" name="recommendation" value="not sure" class="inline">Not sure</label>
          </label>
          </div>
        </section>
        <section>
          <label for="features">What is your favorite feature of freeCodeCamp?
            <select id="features" name="features">
              <option value="">select one</option>
              <option value="1">challenges</option>
              <option value="2">projects</option>
            </select>
          </label>
          <label class="group">What would you like to see improved? (<div>Check all that apply</div>)
            <label for="font projects" ><input id="font projects" value="font-end projects" type="checkbox" name="improve" class="inline">Font-end projects</label>
            <label for="back projects" ><input id="back projects" value="back-end projects" type="checkbox" name="improve" class="inline">back-end projects</label>
            <label for="challenges" ><input id="challenges" value="challenges" type="checkbox" name="improve" class="inline">Challenges</label>
          </label>
        </section>
        <label for="comment">
          <textarea id"comment" name="comment" placeholder="Any comments or suggestions?" cols="16" rows="3"></textarea>
        </label>
        
      </fieldset>
    </form>
  </body>
</html>
/* file: styles.css */
body{
  background-color: rgba(115, 114, 187, 0.5);
  background-image: url(https://www.questback.com/wp-content/uploads/2021/11/Sales-Surveys-scaled.jpg);
  width: 100%;
  margin: 0;
  font-family: Sans-Serif;
}


p{
  font-style: italic;
}

div{
  display: inline-block;
  font-size: 13px;
}

h1, p{
  margin: 1em auto;
  text-align: center;
}

fieldset{
  padding: 0px 20;
  background-color: rgba(35, 35, 68, 0.9);
  border: none;
}

form{
  width: 70%;
  margin: 0 auto;
  min-width: 300px;
  max-width: 500px;
}

input,
textarea,
select{
  width: 100%;
  margin: 5px 0 0 0;
}

.group label{
  margin: 5px 0;
}

label{
  display: block;
  margin: 1em 0;
}

.inline{
  width: unset;
  margin: 0 5px 0 0;
  vertical-align: middle;
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.95

Challenge: Survey Form - Build a Survey Form

Link to the challenge:

Welcome to our community!

Ad the folowing property in your ‘body’ selector:

box-shadow: inset 0 0 0 1000px rgba(0,0,0,.2); 
  • change the value of the last number in ‘rgba’ to create different shade over the background image
1 Like

This page has some different examples. It is using a modal but the same ideas would apply to a color overlay on a background image.

The example form is using a pseudo-element for the overlay BTW.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.