Please help me changing font family

Hi there,

I have a problem changing the font family for the entire content. The code I entered only changed h1 & p font family but the rest of the body remained font family by default. Please anybody help me understand where it went wrong??

Thanks,

<!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <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">  
                <fieldset>
                    <label for="name-label">Name <input id="name" type="text" placeholder="Enter your name" required></label>
                    <label for="email-label">Email <input id="email" type="email" placeholder="Enter your email" required></label>
                    <label for="number-label">Age (optional) <input id="number" type="number" max="120" min="0" placeholder="age"></label>
                    <label for="current-role">Which option best describes your current role? 
                        <select id="dropdown" name="current-role" required>
                            <option value="">Select current role</option>
                            <option value="1">Student</option>
                            <option value="2">Full time job</option>
                            <option value="3">Full time learner</option>
                            <option value="4">Prefer not to say</option>
                            <option value="5">other</option>
                        </select>
                    </label>
                </fieldset>
                <fieldset>
                    <label for="refer-friend">Would you recommend freeCodeCamp to a friend?
                    </label>
                    <label for="Definnitely"><input id="Definitely" type="radio" name="referal" class="inline">Definitely</label>
                    <label for="Maybe"><input id="Maybe" type="radio" name="referal" class="inline">Maybe</label>
                    <label for="Not Sure"><input id="Not sure" type="radio" name="referal" class="inline">Not sure</label>
                </fieldset>
                <fieldset>
                    <label for="favorite-feature">What is your favorite feature of freeCodeCamp?
                        <select name="favorite-feature" id="favorite-feature">
                            <option value="">Select an option</option>
                            <option value="">Chanllenges</option>
                            <option value="">Projects</option>
                            <option value="">Community</option>
                            <option value="">Open Sourse</option>
                        </select>
                    </label>
                </fieldset>
                <fieldset>
                    <label for="Improvement">What would you like to see improved? (Check all that apply)</label>
                    <label for="Front-end Projects"><input type="checkbox" class="inline">Front-end Projects</label>
                    <label for="Back-end Projects"><input type="checkbox" class="inline">Back-end Projects</label>
                    <label for="Data Visualization"><input type="checkbox" class="inline">Data Visualization</label>
                    <label for="Challenges"><input type="checkbox" class="inline">Challenges</label>
                    <label for="Open Source Community"><input type="checkbox" class="inline">Open Source Community</label>
                    <label for="Gitter help rooms"><input type="checkbox" class="inline">Gitter help rooms</label>
                    <label for="Videos"><input type="checkbox" class="inline">Videos</label>
                    <label for="City Meetups"><input type="checkbox" class="inline">City Meetups</label>
                    <label for="Wiki"><input type="checkbox" class="inline">Wiki</label>
                    <label for="Forum"><input type="checkbox" class="inline">Forum</label>
                    <label for="Additional Courses"></label><input type="checkbox" class="inline">Additional Courses</label>
                </fieldset>
                <fieldset>
                    <label for="Suggestions">Any comments or suggestions?</label>
                    <label for="enter-comments"><textarea name="enter-comments" id="enter-comments" cols="30" rows="10" placeholder="Enter your comment here..."></textarea></label>
                </fieldset>
                <input type="submit" value="submit">
            </form>
        </body>
    </html>
body {background-color: #7e76c2;

color: rgb(255,255,255);

width: 100%;

height: 100vh;

Font-family: Tahoma;

Font-size: 16px}

h1,p {text-align: center;

Margin: 1em auto}

p {font-style: italic;}

label {display:block;

margin: 0.5rem 0;}

form {background-color: rgba(19,19,57,50%);

width: 60vh;

max-width: 750px;

min-width: 300px;

margin: 0 auto;

padding: 2em;}

fieldset {border: none;

padding: 1rem 0;

border-bottom: 3px;

}

input,textarea,select {margin: 10px 0;

width: 100%;

min-height: 2em}

.inline {width: unset;

margin: 0 0.5em 0 0;

vertical-align:middle;}

input[type="submit"] {display:block;

width: 100%;

margin: 1em auto;

height: 2em;

font-size: 1.1rem;

background-color: aquamarine;

min-width: 300px;}

Hi there

Please help me understand why my code in CSS is only able to change font family in h1 & p but the rest of the body remained unchanged.

Please help me understand where it went wrong.

THANKS!!

   <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <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">  
                <fieldset>
                    <label for="name-label">Name <input id="name" type="text" placeholder="Enter your name" required></label>
                    <label for="email-label">Email <input id="email" type="email" placeholder="Enter your email" required></label>
                    <label for="number-label">Age (optional) <input id="number" type="number" max="120" min="0" placeholder="age"></label>
                    <label for="current-role">Which option best describes your current role? 
                        <select id="dropdown" name="current-role" required>
                            <option value="">Select current role</option>
                            <option value="1">Student</option>
                            <option value="2">Full time job</option>
                            <option value="3">Full time learner</option>
                            <option value="4">Prefer not to say</option>
                            <option value="5">other</option>
                        </select>
                    </label>
                </fieldset>
                <fieldset>
                    <label for="refer-friend">Would you recommend freeCodeCamp to a friend?
                    </label>
                    <label for="Definnitely"><input id="Definitely" type="radio" name="referal" class="inline">Definitely</label>
                    <label for="Maybe"><input id="Maybe" type="radio" name="referal" class="inline">Maybe</label>
                    <label for="Not Sure"><input id="Not sure" type="radio" name="referal" class="inline">Not sure</label>
                </fieldset>
                <fieldset>
                    <label for="favorite-feature">What is your favorite feature of freeCodeCamp?
                        <select name="favorite-feature" id="favorite-feature">
                            <option value="">Select an option</option>
                            <option value="">Chanllenges</option>
                            <option value="">Projects</option>
                            <option value="">Community</option>
                            <option value="">Open Sourse</option>
                        </select>
                    </label>
                </fieldset>
                <fieldset>
                    <label for="Improvement">What would you like to see improved? (Check all that apply)</label>
                    <label for="Front-end Projects"><input type="checkbox" class="inline">Front-end Projects</label>
                    <label for="Back-end Projects"><input type="checkbox" class="inline">Back-end Projects</label>
                    <label for="Data Visualization"><input type="checkbox" class="inline">Data Visualization</label>
                    <label for="Challenges"><input type="checkbox" class="inline">Challenges</label>
                    <label for="Open Source Community"><input type="checkbox" class="inline">Open Source Community</label>
                    <label for="Gitter help rooms"><input type="checkbox" class="inline">Gitter help rooms</label>
                    <label for="Videos"><input type="checkbox" class="inline">Videos</label>
                    <label for="City Meetups"><input type="checkbox" class="inline">City Meetups</label>
                    <label for="Wiki"><input type="checkbox" class="inline">Wiki</label>
                    <label for="Forum"><input type="checkbox" class="inline">Forum</label>
                    <label for="Additional Courses"></label><input type="checkbox" class="inline">Additional Courses</label>
                </fieldset>
                <fieldset>
                    <label for="Suggestions">Any comments or suggestions?</label>
                    <label for="enter-comments"><textarea name="enter-comments" id="enter-comments" cols="30" rows="10" placeholder="Enter your comment here..."></textarea></label>
                </fieldset>
                <input type="submit" value="submit">
            </form>
        </body>
    </html>

body {background-color: #7e76c2;

color: rgb(255,255,255);

width: 100%;

height: 100vh;

Font-family: Tahoma;

Font-size: 16px}

h1,p {text-align: center;

Margin: 1em auto}

p {font-style: italic;}

label {display:block;

margin: 0.5rem 0;}

form {background-color: rgba(19,19,57,50%);

width: 60vh;

max-width: 750px;

min-width: 300px;

margin: 0 auto;

padding: 2em;}

fieldset {border: none;

padding: 1rem 0;

border-bottom: 3px;

}

input,textarea,select {margin: 10px 0;

width: 100%;

min-height: 2em}

.inline {width: unset;

margin: 0 0.5em 0 0;

vertical-align:middle;}

input[type="submit"] {display:block;

width: 100%;

margin: 1em auto;

height: 2em;

font-size: 1.1rem;

background-color: aquamarine;

min-width: 300px;}

It’s font-family and font-size (notice everything is lowercase).

Update: Oh Snap, I am wrong here. I forgot that most CSS property names are not case sensitive, so you can disregard this answer. You can use Font-family if you like, but because almost no one would ever do that, I would recommend against it.

1 Like

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

OK, new, better post :slightly_smiling_face:

Do you have the Tahoma font installed on your computer? I don’t have it on mine so everything is using the default font style. But if I change your Font-family property to a font I do have then it works just fine.

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