Adjusting Styles for Better Appearance

Topic Overview and Actualization

Hello there! Previously, we learned HTML and basic CSS. Today's mission is 'Adjusting Styles for Better Appearance'. We're going on a CSS adjustment journey to give a polished touch to our to-do list. Let's dive right in!

Websites or apps catch your eye due to their style. Styling in web development ensures applications are visually appealing and user-friendly. Real-world examples of styled websites might have different colored headers, larger titles, or buttons that change color on hover — all of these are styling adjustments that enhance the user experience.

Aligning Text and Other Elements

Well-aligned elements, like symmetrical objects, are pleasing to our eyes. CSS provides alignment properties, like text-align, which sets horizontal text alignment. Let's align our to-do list to the center:

#todo-list {
    /* Center-aligns text within the to-do list */
    text-align: center;
}

Playing with Colors

Color is another crucial aspect of web design. Consistent color schemes can enhance the user experience. CSS properties color and background-color set text and background colors, respectively.

#todo-list {
    text-align: center;
    /* Sets the background color to sky blue */
    background-color: skyblue;
    /* Sets the text color to white */
    color: white; 
}

Adjusting Font Styles and Sizes

With CSS, we can play around with hundreds of different font styles and sizes and make certain text stand out or align with aesthetic requirements. The properties influencing fonts are font-family (the type of the font), font-size (the size of the font), and font-weight (the thickness of the font).

#todo-list {
    text-align: center;
    background-color: skyblue;
    color: white;
    /* Sets the font type to Arial (default is sans-serif) */
    font-family: Arial, sans-serif;
    /* Sets the font size to 20 pixels */
    font-size: 20px;
    /* Makes the text appear bold */
    font-weight: bold; 
}

We used the Arial font, made the text bold, and increased the font size.

Adding Padding for Space Inside Elements

Padding adds space inside an element, creating room between the content and its border. This can make content look less cramped and more readable.

#todo-list {
    text-align: center;
    background-color: skyblue;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: bold;
    /* Adds 20 pixels of padding on all sides */
    padding: 20px; 
}
Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal