0
0
CSSmarkup~20 mins

After pseudo-element in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
After Pseudo-element Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What will be displayed by this CSS code?
Consider the following HTML and CSS. What text will appear after the paragraph content in the browser?
CSS
p::after { content: ' - Read more'; color: blue; }
AThe paragraph text followed by ' - Read more' in blue color.
BOnly ' - Read more' in blue color, no paragraph text.
CThe paragraph text followed by ' - Read more' in default black color.
DThe paragraph text with no extra text after it.
Attempts:
2 left
💡 Hint
The ::after pseudo-element adds content after the element's content.
selector
intermediate
1:30remaining
Which selector correctly targets the after pseudo-element of all list items?
You want to style the after pseudo-element of every
  • element. Which CSS selector should you use?
  • A.li::after
    Bli:after
    Cli::after
    Dli.after
    Attempts:
    2 left
    💡 Hint
    The modern syntax for pseudo-elements uses two colons (::).
    🧠 Conceptual
    advanced
    1:30remaining
    What happens if you use the after pseudo-element without the content property?
    Given this CSS: p::after { color: red; } What will be the visible effect in the browser?
    AThe browser will show an error and ignore the rule.
    BA red empty box will appear after the paragraph.
    CThe paragraph text will turn red.
    DNo visible content will appear after the paragraph because content is missing.
    Attempts:
    2 left
    💡 Hint
    The content property is required for pseudo-elements to display anything.
    layout
    advanced
    2:00remaining
    How to make the after pseudo-element appear on a new line?
    You want the text added by ::after to appear below the element's text, not inline. Which CSS rule achieves this?
    CSS
    p::after { content: 'Note'; /* what to add here? */ }
    Adisplay: block;
    Bposition: absolute;
    Cfloat: right;
    Dvisibility: visible;
    Attempts:
    2 left
    💡 Hint
    Changing display to block makes the element take full width and appear on a new line.
    accessibility
    expert
    2:30remaining
    What is the accessibility concern when using the after pseudo-element to add important text?
    If you add important information using ::after content, what accessibility issue might occur?
    AThe content will cause keyboard navigation to break.
    BScreen readers may not read the content added by <code>::after</code>.
    CThe content will always be read twice by screen readers.
    DThe content will be visible only on mobile devices.
    Attempts:
    2 left
    💡 Hint
    Pseudo-elements content is often ignored by assistive technologies.