Plan the layout for a real reading task
Start with a fictional Ambala workshop catalogue. The visitor is using a phone and wants to identify a topic, check which beginners can join and reach the workshop page. Your job is to present this information clearly with CSS. Use a page with a header and two navigation links, an introduction, six course cards and a contact section. Draft the content in HTML before choosing colour, typography or layout. One short title, one long title and one item with an image will reveal problems that uniform placeholder text hides.
Keep styles in a separate styles.css file and link it from the head. Confirm the link by applying a temporary background colour, reloading and inspecting the rule that applied it. If there is no change, check the CSS file path in the Network panel. Remove the test rule and set a readable default text colour and line height. Use spacing values that you can apply consistently. A group of related sizes such as 8, 16, 24 and 32 pixels is enough to lay out this small site.
Sketch both widths before writing layout rules
Draw the header and cards on a narrow screen and on a wider view. On the narrow sketch, stack the cards with the action after each description. On the wider sketch, decide whether column alignment or reading order matters more. One useful plan is to use an even card grid that can become one column as space runs out, with a flexible header row that wraps before its navigation becomes unreadable.
Instead of deciding all widths in advance, label one primary constraint in each region. The course titles need enough space to wrap within two or three lines. The menu links need a visible focus outline. The introduction needs a limit so the sentences are readable on large screens. Style and test each constraint as you progress. A predictable layout comes from understanding how its contents behave under different conditions.
Select, inherit and trace styles
A selector matches elements. A type selector can target every link, a class can identify a reusable component, and a selector with a descendant combinator can target something inside a component. Use a class named workshop-card for shared card styles. Add featured to one card and use a combined selector when you need to change that card specifically. Leave common appearance in the base class. Find the matching elements in the browser inspector before assuming your rule is responsible for an unexpected change.
The cascade determines the winning values when multiple declarations apply. Origins, importance and layers influence precedence. Among competing rules that are otherwise alike, specificity and order help decide what wins. Class-based selectors are a good starting point for component work. Try setting a link colour in a rule aimed at all links and another in a rule for links inside a course card. Inspect the applied value instead of adding an override without seeing the actual source of the conflict.
Test inheritance using a simple card
Give the body a text colour and add a paragraph inside the card. Check its computed colour. It may inherit the value from its parent unless a more specific value is set on it. Set padding on the card and see whether the paragraph gets the same own padding. It will not automatically inherit the box spacing. These two checks help separate the appearance of the outer card from the values calculated for its contents.
Now give a particular card a different text colour. Observe whether the colour cascades to its title, description and links. A link may have its own rule already, which prevents it from inheriting that colour. Look at the Styles and Computed panels and identify the origin of each value. Leave yourself a short comment only when a surprising rule needs a reason. Clear class names should usually provide enough context.
Control dimensions with the box model
Draw a box with a content area, padding, border and margins. The content holds text or media. Padding creates space inside the edge where the card background appears. The border surrounds that padding. Margins can provide outer spacing in your layout. In developer tools, select a card and inspect these areas while changing one dimension. Try moving padding from the parent to a child's margin and observe why the result looks different.
With content-box sizing, a width normally applies to the content itself. Horizontal padding and borders enlarge the outer box. With border-box sizing, the declaration includes those parts within its width. Try a declared width of 300 pixels, horizontal padding of 16 pixels on each side and a one-pixel border. The outer widths before margins are 334 pixels and 300 pixels respectively. Compare both in the Computed pane and then use a sizing rule you can consistently explain.
Avoid two sources of spacing for the same purpose
Use padding on a card to separate its contents from its edge and gap on the courses container to separate cards. Temporarily give all cards extra bottom margins as well as a grid gap. Observe the inconsistent-looking spacing at the row and final edge. Remove the duplicated constraint. Use the same exercise to compare an inner heading margin with the card's top padding. Appropriate spacing rules make it possible to adjust one component without editing the whole page.
Test a long workshop label and a full mock filename. Find the first element that extends past the available width. If a long word does not wrap, look at wrapping rules for the text. If the child itself is wider than its container, check the child's width or intrinsic minimum. A hidden horizontal scrollbar can conceal the symptom while leaving important text inaccessible. Confirm that the full item can still be read after your targeted fix.
Use Flexbox for a row and Grid for the catalogue
Flexbox lays out a group of items along a main axis. Use it inside the header to position a brand and links or inside a card to place content vertically. In a row, the main and cross axes are oriented differently from a column. Identify the current flex direction before deciding if justify-content or align-items is the property needed for a repair.
Build the navigation as links it can wrap when there is limited room. Keep enough gap that each link can be focused or tapped without ambiguity. Test a long action label such as “Check the next available weekend batch” and observe whether the row still fits. Preserve source order so the keyboard order remains predictable. For a straightforward catalogue, a row that wraps into two lines may be easier to use than a menu whose state is complicated.
Grid helps you arrange a collection into rows and columns that line up. Start with a single readable column, then let other columns appear when they fit. Inside each card, a flex column can help an action remain near the bottom even when neighbouring cards contain different amounts of text. Test the actual content instead of setting a fixed height based on the design mockup. If a spacious desktop card has unused space, check whether the action placement and reading order still make sense.
.workshops {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
gap: 1rem;
}
.workshop-card {
display: flex;
flex-direction: column;
padding: 1.25rem;
border: 1px solid #cad4e3;
}
.workshop-card .action {
align-self: flex-start;
margin-block-start: auto;
}
Predict a grid before confirming it
If each card needs around 272 pixels and the gap is 16 pixels, two columns need 560 pixels of inside width and three need 848. The page's actual content box may be narrower than the viewport because of outer padding or a sidebar. Measure the actual grid, resize the browser and observe when another column fits. Remove a card and see how the layout handles empty track space. Replace the title with a long one and confirm it can wrap.
Make layout breakpoints follow the content
Write a usable base at the smallest practical width, then add enhancements as there is room. Use a media query when the layout itself needs a distinct arrangement. A sample introduction might be stacked on a phone and appear as an image beside text on a larger display. Start by changing the available width until the current arrangement looks constrained, then identify the actual width at which a change would help.
Give the content a readable measure at desktop sizes by limiting its width while preserving margins. Keep images within their card and preserve their proportions. An aspect ratio can make cards easier to scan, but check whether cropping hides the information in a screenshot. Keep labels and dates as text rather than placing them inside decorative images. This allows a reader to zoom, copy or navigate the information independently of the media.
Test three widths and larger text
Resize through a narrow phone, a medium window and a wide desktop. At each size read the introduction and all the card actions. Increase browser zoom and run the sequence again. Try one three-line heading and a card with a much longer description. Note the first element whose text is clipped or whose container becomes too wide. Work from the failing content outward. Changing the global viewport rules is excessive if one component owns the overflow.
In a follow-up run, replace a square thumbnail with a very wide image. Check the width, height and visible crop. Preserve the proportions when the layout only needs a smaller image. If you choose intentionally to crop the thumbnail, keep important parts visible and retain a useful alternative and caption in the markup. When spacing looks different after an image loads, set appropriate HTML dimensions or reserve the intended space in the design.
Set type, focus and colour according to purpose
Use a small set of sizes and weights for a visible hierarchy. Make section headings easy to distinguish from card headings and keep rows of text at a comfortable length. Line height can improve readability at small screen sizes. Use a text role, muted role and action role in the colour system. Avoid applying the same light grey to both decorative and important information.
An action link should be recognisable when seen with a mouse, keyboard or touch interface. Underline links inside running text unless another clear treatment identifies them. Provide a visible focus indicator and check that layouts or clipping do not hide it. A hover style adds feedback with a pointer. The link's purpose and the ability to find it should remain clear on a touch screen.
Repair one contrast issue and prove the change
Make one card use a very pale grey link and inspect how it looks. For ordinary-sized text, WCAG AA commonly uses a contrast target of at least 4.5 to 1, while large text has a different threshold. Check the specific foreground against the actual background with a contrast tool and replace the colour with one that reaches the target. Then tab to the card and inspect the outline. Make sure the focus indication appears even when the card group is narrow or an adjacent image uses a similar colour.
Motion can mark an interaction, but it should never carry information on its own. Apply transitions only where the visible transformation helps clarify a change. If the project uses them, check what happens under reduced-motion settings. A focused or expanded control needs a useful appearance even when movement is unnecessary. Keep the underlying text and layout informative before adding decorative effects.
Read developer tools as a series of small checks
Select the smallest element that exhibits the problem. Check which declarations matched, compare the computed values and inspect the parent that controls placement. Temporarily toggle a declaration to test a hypothesis. Apply the successful repair to the real stylesheet and reload. Edits in the inspector generally do not persist, so the reload proves that you saved the same change in the correct file.
Reproduce three common layout failures
- A card action appears halfway up the row. Confirm its card is a flex column and has remaining height after the content. Apply an auto margin on the block start of the final action, then compare cards with different amounts of text.
- A horizontal scrollbar appears only after a thumbnail is loaded. Inspect image size and parent size, constrain the image inline and check that its height retains the expected ratio. Test a long title separately to see whether both issues contributed.
- A stacked header is visually correct but Tab jumps between links in a confusing order. Check source order and any flex or grid ordering rules. Put important items in meaningful source order before arranging them visually.
Write the original symptom and the adjustment that fixed it. Show what happened to the computed appearance, and run the same check at another width. If the fix removes the problem at exactly one width and introduces it at another, look for a more flexible rule rather than adding multiple narrow exceptions.
Deliver a responsive course catalogue
The portfolio deliverable includes an introduction, six course cards and a contact action. Style it from a neutral HTML version and keep a test log. Use fictional classes and images whose usage you can explain. Include examples with long, short and missing optional descriptions so a reviewer can inspect how your layout supports different data.
- Write a semantic HTML outline and check it without styles.
- Add typography, common colours and a small spacing scale.
- Use a flexible header and grid of cards. Test column count and action placement.
- Check visibility with a keyboard, narrower screens and increased zoom.
- Repair at least one issue and describe it in your README.
- Include screenshots that demonstrate responsive behaviour, rather than only the widest and most polished result.
Explore a related layout before you finish
Turn the same catalogue into a page for a college club with three events. Keep typography and card styles and replace the content. Determine which changes happen because of content length, which need new rules and which are handled already. See whether a card with no image remains useful. Save the two versions as evidence of a reusable pattern. That is more informative in a portfolio than showing one isolated screenshot.
Prepare to show CSS decisions in an interview
Show a worked example and then a measurable check. If you say you used Flexbox for a row, point to the alignment axis and show the row when it wraps. If you say you improved responsive behaviour, show the layout before and after the breakpoint. Walk through the computed style of a card and explain what comes from its own selector, from inheritance and from the layout parent.
- Explain how the browser chose between two conflicting link colours.
- Calculate the outside width from content, padding and border for each sizing mode.
- Describe why the course grid and its header benefit from different layout methods.
- Reproduce a keyboard focus issue and demonstrate your repair at two widths.
- Compare two card titles of different lengths and explain why the final action remains usable.
Prepare two minutes of evidence for the problem you understand best. A reusable stylesheet comes from decisions you can explain, such as naming a layout class, setting a width on a parent or adjusting a narrow screen after observing an actual failure.
What to know before joining CSS training
Should I learn JavaScript first?
Start with basic HTML, including headings, links, lists and classes. CSS does not require JavaScript for a responsive layout. A little browser inspection practice is useful. Add interactive code only after you can see the role of the elements that will be updated.
How do I practise when I do not have a design brief?
Take a real reading task and write your own mock brief. Build a useful page before working on polished appearance. Ask someone to find one workshop, see whether it suits a beginner and reach the course page. If they get stuck, identify the specific decision you can improve.
Can I use a design framework later?
First make a small layout with your own CSS. A framework can provide reusable patterns, but you will still need to understand cascade, box sizing, layout and accessibility to customise them confidently. If you are attending classes in Ambala between school or college commitments, bring one working example and one reproducible issue to the lab.
Use a stylesheet review to make your design easier to maintain
Review the stylesheet after the prototype works. Separate declarations that apply across the whole page from those that belong to a single component. A default heading margin can help the entire site. An exception for a course card title belongs next to the card styles. If several unrelated rules use exactly the same border colour by design, give it a descriptive custom property. A future change can then be made in one place. Leave values separate when they only happen to look alike today.
Test component styles on a second page
Make a second HTML page for registration details and reference the same stylesheet. Reuse the header and one small card, then add a short labelled form. Check whether the registration page forces you to copy any styles. If a rule needed for every card is hidden inside a catalogue selector, move it to the card class. If a rule reserved for the catalogue changes a field on the registration page, narrow the selector to the correct component. This experiment catches dependencies that do not show up in a single screenshot.
Check a form without squashing the controls
Style each form field as a small group containing a label, a control and optional help text. Give the fields a readable font size and useful vertical spacing. Place action buttons on their own row at a narrow width. Use a visible style for error messages and associate the message with the field in the HTML. A red border by itself can be hard to notice and does not explain the correction required.
Enter one long mock email value, open the page at a narrow width and check that the control stays inside the form card. Move through the fields with the keyboard. Use the browser to emulate the focus state on different backgrounds. Inspect whether the card's border or overflow masks the outline. These checks turn a design task into a useful exercise for maintaining real enquiry pages.
Compare a design revision safely
Duplicate the page before changing the design, or save the starting point in version control. Prepare a revision where the action colour is darker, the catalogue cards have more line spacing and one row of links wraps earlier. Compare the two versions with the same viewport and content. If readability improves but the header becomes too tall, keep the useful text change and revisit the spacing near the navigation. A design revision works better when each change has a measurable purpose.
Use a simple handoff note for the finished stylesheet. List the location of the shared variables, the classes needed for a card, the meaning of the main media query and the widths you checked. Point out anything the next developer should test when adding a longer label or another navigation link. Include a screenshot only if it illustrates a specific layout question.
A stretch challenge for your next practice session
Add a printable workshop schedule. Open print preview and see which elements a reader needs on paper. Use a print media rule to simplify backgrounds and remove purely decorative images or navigation. Retain the content that explains the schedule and how to contact the organiser. Your screen version and print version use the same semantic source, but the paper layout can prioritise dates, rows and readable margins. Compare print preview with the screen view and document which rules only apply to print.
Use a small style comparison to evaluate readability
Create two versions of the catalogue introduction with the same original text. In one, let the lines span the full wide viewport. In the other, set a readable maximum line length on the text wrapper and keep the surrounding layout flexible. Ask a classmate to answer the same course question from both pages. You can observe if they lose their place or have difficulty finding the next line. This practical test gives you feedback beyond the appearance of a static screenshot.
Try a stronger heading hierarchy before changing colours
Use the same font family and foreground colour in both versions. Increase the space before section headings, reduce the space between a headline and the supporting paragraph, and align labels with the cards they describe. Observe whether the next step is easier to find even before you choose the final colours. Then check the same layout at narrow width. A heading needs enough room to wrap without looking disconnected from the text below it.
Record an actual spacing improvement
Open the browser inspector and measure the featured heading's bottom margin, the descriptive paragraph's margins and the whole card group's gap. If the gap between heading and paragraph is much larger than the gap to the next section, a reader can mistake the groups. Adjust the relevant values rather than changing every margin in the stylesheet. Write down the old and new behaviour on desktop and mobile. The goal is to show that the revised structure explains which pieces belong together.
Review your changes with real text
Ask your reviewer to find the workshop that accepts beginners, identify its action and read what they need to bring. See whether they can finish those tasks after increasing zoom or widening the browser. Check the result with only the keyboard. Include one observation about the parts of the layout that stayed useful when the content changed. This feedback is good material for a portfolio explanation because it ties a specific CSS decision to an actual visitor task.