Build reusable UI components with pure CSS, work like a professional, and finish five complete websites.
Every example opens in a live browser preview. Click ✎ Edit on any preview, or press L, to open the Code Lab.
class="btn btn-outline btn-sm".| Component | Key CSS idea |
|---|---|
| Alert | Coloured left border + light background per type |
| Badge | Small inline-block pill, border-radius |
| Breadcrumb | Flex list; separator with li + li::before |
| Pagination | Flex row of boxed links; .on for current page |
<nav aria-label="Breadcrumb">.open attribute: <details open>.#offer. The element with that id matches :target and appears. The × link goes to # and it hides again.:target<dialog> element with a little JavaScript. :target is great for learning and simple popups.#t2:checked ~ .p2 shows the matching panel:checked.content: attr(data-tip) shows the text stored in the HTML attribute::before and transparent borders:checked + .sl moves the knobdata-tip. Change the button to an outline variant. Add an alert above the card: "Only 5 seats left!".<details> and <summary>#callback.modal:target shows it with a fade#data-tip attribute on a small "?" icon::after with content: attr(data-tip)::before:hover and :focus (add tabindex="0")appearance: none + background gradientModule 19: Professional Workflow – clean code, accessibility, SEO and putting your site online.
Q1. Which HTML element gives an accordion for free?
Q2. What makes the :target modal appear?
Q3. Show the text of data-tip in CSS:
index.html (servers open it by default)about-us.html, team-photo.jpgLogo.PNG and logo.png are the same. On real web servers (Linux) they are different files, so images break after uploading.| Section | Why |
|---|---|
| Reset | Browsers have different default margins and sizes; reset makes them equal |
| Variables | Brand colours and sizes in one place |
| Base | Body font, headings, links |
| Layout | Containers, grids, page structure |
| Components | Buttons, cards, navbars... |
| Utilities | Small helpers like .text-center |
.title classes. Specificity stays low and equal.| Problem | How to find it |
|---|---|
| Something is too wide / sideways scroll | * { outline: 1px solid red } and look for the box that sticks out |
| Style not applying | DevTools > Styles: is it crossed out? Check spelling and specificity |
| Unexpected gap | DevTools box model: margin or padding? Margin collapse? |
| Flex/Grid confusion | DevTools shows a "flex" / "grid" badge: click it to draw the lines |
| Image not showing | Console / Network tab: 404 = wrong path or capital letters |
Example report for a student project. Aim for 90+ in every category.
| Common issue | Fix |
|---|---|
| Images too big | Resize, compress, use WebP, loading="lazy" |
| Low contrast text | Darker text / lighter background (4.5 : 1) |
| Missing alt / labels | Add alt to images, label to inputs |
| No meta description | Add one in the head |
| Tap targets too small | Buttons and links at least 44px tall |
| Render-blocking fonts | Load fewer fonts; use display=swap |
Link preview built from og: tags
<h1> with the main keyword ("Kulhad Chai in Ranchi")username.github.io/project.yourname.in (about a few hundred rupees a year) and connect it in settings.profile__button (a contact link). Create a modifier profile--dark with a dark background. Add a meta description and Open Graph title..notice, elements __title, __text, __date.notice--urgent instead of a separate stylelang="en" and a proper page title<button>* { outline: 1px solid red } to see the boxesdisply: flex typo404.html) with a link homeModule 20: Capstone Projects – build 5 complete, real-world websites.
Q1. In BEM, which is an ELEMENT?
Q2. Why use lowercase file names?
Q3. Which tags control the WhatsApp link preview?
| Step | Tip |
|---|---|
| Wireframe | Draw boxes for each section on paper first. 10 minutes of planning saves 2 hours. |
| HTML | Write all content with semantic tags before any CSS. |
| CSS | Reset → variables → base → layout → components. |
| Responsive | Check 360px, 768px and 1280px widths in DevTools. |
| Test | Lighthouse, validator, real phone, a friend using it. |
scroll-behavior: smooth)20 modules · 100 practice examples · 5 capstone projects
BrainBit Infotech, Ranchi
Publish your best two projects and share the links with your trainer!
Q1. What should you do BEFORE writing CSS?
Q2. Which widths should you always test?
Q3. Where can you host a static site for free?
You have finished Part 4 of the Complete HTML + CSS Course.
Keep all your practice files in D:\my-website. You will reuse them in the capstone projects.