Actions

Work Header

Rating:
Archive Warning:
Fandoms:
Additional Tags:
Language:
English
Stats:
Published:
2025-01-26
Completed:
2025-08-15
Words:
2,174
Chapters:
12/12
Comments:
58
Kudos:
54
Bookmarks:
60
Hits:
1,336

How to target specific elements of your work (for work skins)

Chapter 12: Preface Group

Chapter Text

Welcome back! This chapter is about targeting the preface groups!

Things we'll be covering in this chapter:

Let's begin!

Single chapter

Targeting both Preface Groups

#workskin .preface.group {
color: indigo;
background: lightblue;
}

Result:

Targeting only the first Preface Group

#workskin .preface.group:first-of-type {
color: indigo;
background: lightblue;
}

Result:

Targeting only the second Preface Group

Method 1:

#workskin .afterword.preface.group {
color: indigo;
background: lightblue;
}

Method 2:

#workskin .preface.group:last-of-type {
color: indigo;
background: lightblue;
}

Result:

Multi Chapter

Targeting all Preface Groups

#workskin .preface.group {
color: indigo;
background: lightblue;
}

Result:

Targeting all Work Preface Groups

#workskin > .preface.group:first-of-type,
#workskin > .preface.group:last-of-type {
color: indigo;
background: lightblue;
}

Result:

Work - First Preface Group

#workskin > .preface.group:first-of-type {
color: indigo;
background: lightblue;
}

Result:

Work - Last Preface Group

#workskin > .preface.group:last-of-type {
color: indigo;
background: lightblue;
}

Result:

Targeting all Chapter Preface Groups

#workskin .chapter.preface.group {
color: indigo;
background: lightblue;
}

Result:

Chapter - First Preface Group

#workskin .chapter.preface.group:first-of-type {
color: indigo;
background: lightblue;
}

Result:

Chapter - Last Preface Group

#workskin .chapter.preface.group:last-of-type {
color: indigo;
background: lightblue;
}

Result:

Styling Specific Chapters

I learnt about this from Targeting specific AO3 work sections (not site) with CSS effects by Charles_Rockafellor!!

If you want to style different chapters separately, replace the .chapter with #chapter-X and then a space. Replace the 'X' with the number of the chapter you're targeting. Here's an example:

#workskin #chapter-1 .preface.group {
color: indigo;
background: lightblue;
}

#workskin #chapter-2 .preface.group {
color: mediumvioletred;
background: plum;
}

#workskin .preface.group {
color: teal;
background: lightgreen;
}

Result:

(The reason the #chapter-1 and #chapter-2 styles override the general .preface.group style is because they are more specific)

Of course, you can use this like #workskin #chapter-1 .preface.group:first-of-type and #workskin #chapter-1 .preface.group:last-of-type as well. Here's an example:

#workskin #chapter-1 .preface.group:first-of-type {
color: indigo;
background: lightblue;
}

#workskin #chapter-1 .preface.group:last-of-type {
color: mediumvioletred;
background: plum;
}

#workskin #chapter-2 .preface.group:first-of-type {
color: teal;
background: lightgreen;
}

#workskin #chapter-2 .preface.group:last-of-type {
color: brown;
background: coral;
}

Result:

Thanks for reading! I hope this helped. I'll keep updating this fic as I find new stuff!

Notes:

If you find any other methods to select specific sections in a work skin, please let me know!! With your permission, I'll add it into this guide (with credit of course!!)
Happy styling!