Using an image caption in Markdown Jekyll

后端 未结 10 886
一个人的身影
一个人的身影 2021-01-29 18:11

I am hosting a Jekyll Blog on Github and write my posts with Markdown. When I am adding images, I do it the following way:

![name of the image](http://link.com/ima

10条回答
  •  旧巷少年郎
    2021-01-29 18:26

    A slight riff on the top voted answer that I found to be a little more explicit is to use the jekyll syntax for adding a class to something and then style it that way.

    So in the post you would have:

    ![My image](/images/my-image.png)
    
    {:.image-caption}
    *The caption for my image*
    

    And then in your CSS file you can do something like this:

    .image-caption {
      text-align: center;
      font-size: .8rem;
      color: light-grey;
    

    Comes out looking good!

提交回复
热议问题