Forum How do I...?

Remove last instance of a pseudo placed '/'

suehpec
In the attached screenshot the '/' character has been added after every b-head using the following CSS:

p.toc-section-line::after {
content: " / ";
}

We are trying to remove the last instance of the '/' character for each chapter. So far we have used the following CSS but without any luck

p.toc-section-line::last-child {
content: "";
}

Is there another psuedo element that can be used besides ':last-child' to remove the last '/'? I've included all the CSS for the TOC below.

Thank you!








/* Table of Contents */
div.toc {
page-break-before: right;
page: frontmatter;
prince-page-group: start;
margin-left: 0;
margin-right: 0;
padding: 0;
}

.toc p {
/* tweak this to get the hanging indent aligned */
margin-left: 12pt;
text-indent: -20pt;
text-align: left;
font-style: normal;
font-weight: normal;
hyphens: none;
}

p.toc-preface-line,
p.toc-bibliography-line,
p.toc-appendix-line,
p.toc-glossary-line {
margin-top: 8pt;
margin-bottom: 4pt;
font-variant: small-caps;
}

p.toc-part-line {
page-break-after: avoid;
margin-top: 16pt;
margin-bottom: 2pt;
}

span.toc-part-label, span.toc-chapter-label {
font-size: 10pt;
font-family: AGaramondPro;
font-style: normal;
}

/* remember to keep the "a" in this selector for styling */
span.toc-part-title a {
font-family: AGaramondPro;
font-style: normal;
}

p.toc-chapter-line {
page-break-inside: avoid;
margin-top: 8pt;
margin-bottom: 3pt;
/*margin-left: 12pt; /\*make 28pt if Part*\/*/
line-height: 14pt;
}

/* remember to keep the "a" in this selector for styling */
span.toc-chapter-title a {
}

/* to Generate Page Numbers for TOC, including roman for preface
see Walking With Jesus/Life & Revolution if using leaders in TOC*/
div.toc a::after, div.toc p.toc-part-line a::after {
content: leader('.') target-counter(attr(href), page);
/*float: right;*/ /*If no leaders*/
font-size: 9.5pt;
font-family: AGaramondPro;
}
div.toc p.toc-preface-line a::after {
content: leader('.') target-counter(attr(href), page, lower-roman);
/*float: right;*/ /*If no leaders*/
font-size: 9.5pt;
font-family: AGaramondPro;
font-variant: normal;
}

p.toc-section-line {
display: inline;
text-align: left;
margin-bottom: 2pt;
margin-left: 0;
text-indent: 0;
line-height: 11.5pt;
font-size: 10pt;
font-family: AGaramondPro;
font-style: normal;
}

p.toc-section-line::after {
content: " / ";
}

p.toc-section-line::last-child {
content: "";
}

div.toc p.toc-section-line a::after {display: none;}
p.toc-section-line:last-child {
display: none;
}
  1. Screen Shot 2022-02-07 at 12.08.57 PM.jpg239.4 kB
phillipgessert
I think it isn't removing it because it's added via ::after, but you aren't targeting ::after again to remove it. Perhaps :last-child::after would catch it for removal, or you could try something like .toc-section-line:not(:last-child)::after as a way to add it instead.

Edited by phillipgessert