CSS Assignment – 2
Basic Questions
- Create a <div> with some text and apply margin: 20px; to it.
- Add padding: 15px; to a paragraph and observe the effect.
- Give a heading a 2px solid black border.
- Create a box with border-style: dashed and border-color: red.
- Apply border-width: 5px; to a <div> and set a background-color.
- Experiment with margin-top, margin-bottom, margin-left, and margin-right individually.
- Apply different padding values on all four sides of a paragraph (padding: 5px 10px 15px 20px;).
- Style a <div> with box-sizing: content-box and compare its size to box-sizing: border-box.
- Set a paragraph font using font-family: Arial.
- Make a heading bold with font-weight: bold;.
- Italicize a sentence using font-style: italic;.
- Increase the font size of text to 20px.
- Change the color of a paragraph to darkblue.
- Use text-align: center; to align a heading.
- Add line-height: 2; to increase spacing between lines.
- Add extra space between letters using letter-spacing: 3px;.
- Add spacing between words with word-spacing: 10px;.
- Underline a piece of text using text-decoration: underline;.
- Indent the first line of a paragraph with text-indent: 40px;.
- Apply font size using em units and compare with px units.
Intermediate Questions
- Create two <div>s: one with margin: 0 auto; to center it horizontally.
- Design three boxes with different border styles (solid, dashed, dotted) side by side.
- Create a card layout where padding inside makes text not touch the border.
- Add a heading with a double border using border-style: double;.
- Compare differences between content-box and border-box with a fixed width and padding.
- Create text with Google Fonts (e.g., Poppins or Roboto) using a <link> from Google Fonts.
- Import a font using @import (custom font from Google).
- Use font-weight variations: light (300), normal (400), and bold (700).
- Style a block of text and demonstrate font scaling using % and em units.
- Create two paragraphs: one aligned justify and one aligned right.
- Add an example where large letter-spacing creates a special effect in heading.
- Make a text appear uppercase using CSS text-transform.
- Create a blockquote with font-style: italic; and increased line-height.
- Apply a shadow effect using only font properties (text-shadow).
- Use vh units for responsive font sizes that scale with the viewport.
- Create a “Read more” link with text-decoration: none;.
- Style one word in a sentence with a different font family using <span>.
- Experiment with negative text-indent to move first line left.
- Create a heading with increased word-spacing for letterpress effect.
- Apply both rem and em font sizes in nested elements to compare.
Advanced Questions
- Create three equal-width boxes inside a container and explain how margin and padding affect the layout in content-box vs. border-box.
- Make a responsive heading whose font size adjusts using clamp() with px, em, and vw.
- Build a full typography demo with: heading styled with Google Font, paragraph styled with custom imported font, different weights, and spacing.
- Create a pricing card UI where padding, border, and margin are clearly defined to look professional.
- Make a paragraph of justified text look like a newspaper column with line-height, letter-spacing, and word-spacing tuned.
- Create a box where top border is thick, right border is dotted, bottom border is double, and left border is solid.
- Build a responsive hero section with a heading that uses viewport units (5vw) and body text in rem. Test resizing.
- Create a demo comparing absolute font units (px, pt) with relative units (em, rem, vh) to show differences in responsiveness.
- Design a small personal bio section using custom Google Font + text shadow + spacing + underline hover effect.
- Demonstrate combining typography with box model: Style a block with padding, margin, border, custom font, letter-spacing, and centered alignment like a “quote card.”