Skip to content

How do I align figure caption to left, but up to the figure edge? #12032

Answered by mcanouil
HojinCho asked this question in Q&A
Discussion options

You must be logged in to vote

Here is one approach (not perfect) because I had some spare time but I think this is a bad idea which is obvious.
I won't explain the approach nor the code, so you'll have to learn CSS/HTML/JavaScript if you don't understand.

Details

---
title: "Quarto Playground"
format: html
include-in-header:
  - text: |
      <style>
        figure {
          display: block;
          margin: 0 auto;
        }
      </style>
include-after-body:
  - text: |
      <script>
        document.addEventListener("DOMContentLoaded", function() {
          var img = document.querySelector("#fig-placeholder img");
          var figure = document.querySelector("#fig-placeholder figure");
          if (img && f…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@HojinCho
Comment options

@mcanouil
Comment options

mcanouil Feb 6, 2025
Collaborator

Answer selected by HojinCho
@HojinCho
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
figures html Issues with HTML and related web technology (html/css/scss) themes Related to HTML theming or any other style related issue (like highlight-style)
2 participants