Courses / HEC NSCT – National Skill Competency Test: Complete Preparation for Computing Graduates
6.2 HTML and CSS Essentials
Area 6 – Web Development (10%) · 40 min read · 11 MCQs to check yourself
HTML – structure
- Semantic tags:
<header> <nav> <main> <section> <article> <aside> <footer>– better accessibility and SEO. - Links
<a href>, images<img src alt>(alt text for screen readers), lists<ul> <ol> <li>, tables<table> <tr> <td>, forms<form> <input> <label> <button>. - Block elements (
div,p,h1) start on a new line; inline elements (span,a,strong) do not. <!DOCTYPE html>declares HTML5;<meta name="viewport">is needed for mobile.
CSS – presentation
- Ways to add CSS: inline (
style=), internal (<style>), external (<link rel="stylesheet">– best). - Specificity: inline > id (
#main) > class/attribute/pseudo-class (.btn,:hover) > element (p).!importantoverrides (avoid). - Box model: content → padding → border → margin.
box-sizing: border-boxincludes padding and border in the width. - Layout: Flexbox (one-dimensional rows/columns), Grid (two-dimensional).
position: static, relative, absolute, fixed, sticky. - Responsive design: fluid widths, flexible images, media queries (
@media (max-width: 600px)), mobile-first. - Units: px (fixed), %, em (relative to parent font), rem (relative to root font), vw/vh (viewport).
HTML crash course for beginners (Programming with Mosh)
This lesson ends with a quiz of 11 MCQs. Open the lesson on PrepOasis to take it and save your progress.
Previous: 6.1 How the Web Works – Client, Server and HTTP · Next: 6.3 JavaScript and the DOM