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 1 of 17

    What is CSS?

    The shape of a rule: a selector and properties.

    6 minutes3 games

    CSS tells the browser how things look. Each rule has a selector that picks elements and, inside { }, properties written as property: value;.

    HTML
    <style>
      h1 {
        color: teal;
        font-size: 40px;
      }
      p {
        color: #555;
      }
    </style>
    
    <h1>Hello CSS</h1>
    <p>This paragraph is grey.</p>

    Important

    Browsers usually ignore an invalid declaration and continue processing valid CSS.

    Interview question

    How do selectors and declarations differ?

    The 3 selectors you'll use most

    • p by tag: every paragraph.
    • .card by class (dot): any element with class="card"; reuse it freely.
    • #logo by id (hash): the one element with id="logo".
    HTML
    <style>
      .tag { background: gold; padding: 2px 8px; }
      #main-title { color: crimson; }
    </style>
    
    <h2 id="main-title">News</h2>
    <p>Topics: <span class="tag">HTML</span> <span class="tag">CSS</span></p>

    Quick question

    How do you select every element with class="btn"?

    Spot the bug

    One declaration will be ignored because of a syntax mistake. Which?

    Exercise

    Make the h1 red (red).

    HTML
    <style>
      
    </style>
    <h1>Red title</h1>
    

    Learn more from

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

    Played 0 of 3 games

    Sign in to save your progress and earn XP.

    NextCascade and specificity
    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.