CSS Assignment – 3
Basic Questions
- Apply a named color (like blue) to a heading.
- Use RGB format to color a paragraph.
- Apply HEX code (#ff6600) as text color.
- Give a <div> a background color (lightgray).
- Use RGBA to make text 50% transparent.
- Apply a background image to a <div>.
- Repeat a background image using background-repeat: repeat;.
- Set a background image to cover the whole container (background-size: cover;).
- Align a background image to the top left corner.
- Fix a background image with background-attachment: fixed;.
- Create a <span> and a <div> — give both borders and observe block vs inline behavior.
- Place 2 boxes side by side using display: inline-block;.
- Hide a paragraph using display: none;.
- Position a box relative and move it 20px down.
- Float an image to the right so text wraps around it.
- Clear a floating element using clear: both;.
- Create a container with display: flex; and 3 child boxes.
- Use justify-content: center; to center flex items horizontally.
- Use align-items: center; to center flex items vertically.
- Change the flex direction to column and stack items vertically.
Intermediate Questions
- Create a full-page background image that stretches perfectly with background-size: cover.
- Add two layered backgrounds (image + gradient).
- Create a button with transparent background and border.
- Set background position to top right for an image.
- Experiment with background-size: contain; vs cover; on the same image.
- Use linear-gradient background for a header section.
- Apply HSLA color with transparency for an overlay effect.
- Create paragraph text in three different color formats (HEX, RGB, HSL).
- Show the difference between display: block and inline for <div> and <span>.
- Create three inline-block boxes side by side.
- Build an element and hide it using display: none.
- Set one div with position: relative; and move it 20px right.
- Create a box absolutely positioned inside a relatively positioned parent.
- Fix a navigation bar at the top using position: fixed;.
- Create a sticky header that stays visible while scrolling using position: sticky;.
- Create a layout with one floating image on the left and text wrapping around it.
- Apply clear: both; to prevent float overlap.
- Show the difference between static (default) and relative positioning.
- Create boxes with different background colors to visually test margin-collapsing behavior.
- Create 4 divs with different display values: block, inline, inline-block, and none.
Advanced Questions
- Create a layered effect with two gradients + one image background.
- Use HSLA colors to build a dark overlay effect on an image header.
- Build a two-column layout using float properties only (no flex/grid).
- Create a sticky footer that always stays at the bottom of the page.
- Build a fixed navigation bar with transparent background that turns solid on hover.
- Create a hero section where the background image stays fixed while content scrolls.
- Create a responsive card layout using display: inline-block;.
- Design a centered modal (position: fixed;) that overlays page content.
- Build a flex container with 5 items, use justify-content: space-between; and align-items: center;.
- Reorder flex items using the order property to visually shuffle elements.