Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    { }CSS

    Styling foundations

    • What is CSS?
    • Cascade and specificity
    • Selectors and element states
    • Colours and text

    Boxes and sizing

    • Padding, border and margin
    • Units and flexible sizing
    • Overflow and image fitting

    Layout and responsiveness

    • Flexbox
    • CSS Grid
    • Positioning and stacking
    • Responsive design
    • Container-based responsiveness

    Design values, direction and motion

    • CSS custom properties and functions
    • Logical properties for RTL and LTR
    • CSS transitions and transforms
    • Keyframes and bounded animation
    • Project: a product card
    CSS

    Styling foundations · Lesson 4 of 17

    Colours and text

    Colour formats, font size and family.

    7 minutes2 games

    Colours can be names (tomato), hex (#1e90ff) or rgb(30, 144, 255). color sets the text colour and background the background. For text: font-size, font-weight (700 is bold), font-family and text-align.

    HTML
    <style>
      .banner {
        background: #0f172a;
        color: white;
        text-align: center;
        padding: 20px;
        font-family: Georgia, serif;
      }
      .banner strong { color: #38bdf8; font-size: 28px; }
    </style>
    
    <div class="banner">
      <strong>SeaCode</strong>
      <p>Learn to code for real</p>
    </div>

    Important

    Provide font fallbacks and readable line-height. A unitless line-height such as 1.5 scales with each element’s font size.

    Interview question

    Does color change the background?

    Keep enough contrast between text and background. Light grey on white is hard to read.

    Complete the code

    Complete: black background, white text.

    .dark {
      : black;
      : white;
    }

    Exercise

    Make the .note paragraph 20px and bold (font-weight: 700).

    HTML
    <style>
      .note {
        
      }
    </style>
    <p class="note">Remember to save!</p>
    

    Learn more from

    • MDN: CSS referencedeveloper.mozilla.org
    • web.dev: typographyweb.dev

    Played 0 of 2 games

    Sign in to save your progress and earn XP.

    PreviousSelectors and element statesNextPadding, border and margin
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.