making your image and figure robust in bs4 bookdown

I struggle to find how to make my figures and images perfectly aligned in the center of my book. After looking around, I think I’ve found an adequate solution:

Step 1: Change your image into % format.

Step 2: I typically change my width to 100, but you can also leave it as is

Step 3: Go to Attributes tab can put this line into the “CSS styles” box: display: block; margin: 1em auto

Voila! Now your image or figure should be robust to both bs4 or gitbook styles.

Mike Nguyen, PhD
Mike Nguyen, PhD
Visiting Professor of Data Sciences and Operations

My research interests include marketing, and social science.

Next
Previous

Related