pietroppeter / nimib

nimib 🐳 - nim 👑 driven ⛵ publishing ✍
https://pietroppeter.github.io/nimib/
MIT License
181 stars 10 forks source link

Image's title is not centered and below by default #186

Closed dlesnoff closed 1 year ago

dlesnoff commented 1 year ago

I have added one image in my nimib's blog. I found out that the title was slightly off-centered (and not left-aligned neither).

It is also below by default. Is it possible to put it on top of my picture ? image

pietroppeter commented 1 year ago

agree that caption has not good styling, I would welcome a change to make it centered.

I think having a caption on top is non standard (cannot recall figure captions on the top, but would welcome examples), so I would say it should not be provided as an option in nimib. You can of course ovveride the partial of nbImage.

Another option would be to add an element nbTextCentered that writes text in center mode. This and similar stuff to customize text appearances could actually better placed in nimibex repo and probably one should iterate first about the best api.

dlesnoff commented 1 year ago

Do you have any idea why the caption is not on the left ? Is it a blank "Figure:" that does not show ?

I have checked on the Web the typography rules and it seems that the common Western conventions are:

HugoGranstrom commented 1 year ago

Do you have any idea why the caption is not on the left ? Is it a blank "Figure:" that does not show ?

The text is in line with the left edge of the image. And the image is offset because the <figure> tag has a margin. And according to this article:

The extra spacing of the <figure> is applied with the margin property on the left and right sides of the element. This is the default styling found on most browsers, which puts a 40px margin on the left and right and a 1em margin on the top and bottom.

So it is just your browser's default way of showing a figure.

dlesnoff commented 1 year ago

2023-03-28-004312_843x764_scrot Then we may need to overwrite the defaults, and why not use the article's recommendation?

figure {
  margin: 2rem 0;
}
figcaption {
  text-align: center;
}