Expand my Community achievements bar.

SOLVED

AEM Native PDF: How to remove list space when no sentence precedes it

Avatar

Level 4

Hi there,

I'm wondering how I can get lists (OL and UL) to avoid a space break only when no sentence comes before it, or if it is the first bit of content in a section.

Here's an example of the extra space:

joshm19816095_1-1723056300769.png

Any help is much appreciated, as always!

Thanks!

Josh

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 3

It sounds like you need a specific CSS selector to grab the <ol> and <ul> elements that are the first "child" of another element.

CSS Selectors Reference (w3schools.com)

 

In general, this might work for you, but also might have unintended issues:

ol:first-child,
ul:first-child {
  padding-top: 0;
  margin-top: 0;
}

 

It's possible you have styling on the <li> elements causing the spacing. It's hard to answer the question without seeing the template CSS. Regardless, you will have to edit the CSS of your native pdf template to achieve what you want.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 3

It sounds like you need a specific CSS selector to grab the <ol> and <ul> elements that are the first "child" of another element.

CSS Selectors Reference (w3schools.com)

 

In general, this might work for you, but also might have unintended issues:

ol:first-child,
ul:first-child {
  padding-top: 0;
  margin-top: 0;
}

 

It's possible you have styling on the <li> elements causing the spacing. It's hard to answer the question without seeing the template CSS. Regardless, you will have to edit the CSS of your native pdf template to achieve what you want.