Skip to content

How to add captions (such as below images) but anywhere? #1669

Answered by kungfux
mattpopovich asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure about <my-caption> existence and I didn't find it in the code.

There are ways to do this using custom styles.

Make sure you copy assets\css\jekyll-theme-chirpy.scss from this repository to yours.

Option 1. Using tag in markdown

Modify assets\css\jekyll-theme-chirpy.scss to add styles as following

em {
  display: block;
  text-align: center;
  font-style: normal;
  font-size: 80%;
  padding: 0;
  color: #6d6c6c;
}

and then use in posts like

<em>This is my caption</em>

Option 2. By specifying a class with styles

Modify assets\css\jekyll-theme-chirpy.scss to add styles as following

.caption {
  display: block;
  text-align: center;
  font-style: normal;
  font-size: 80%;
  padding

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mattpopovich
Comment options

@kungfux
Comment options

kungfux Nov 19, 2024
Collaborator

Answer selected by kungfux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants