View Single Post
Old 01-28-2023, 08:01 AM   #2
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,349
Karma: 105899727
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Set CSS height or width (class of img tag) to like 95% (2.5% margin either side, I use 90%) and other property to auto.
Don't set margins.
Have it in a paragraph that's centred and use that style for caption too

<p class="some-centred"><img class="generic-landscape" ... etc </img><p>
<p class="some-centred">My Caption</p>

CSS
.some-centred {
text-align: center;
margin-top: 0.5em; /* whatever space above image and caption */
margin-bottom: 0.2em; /* whatever space above image and caption */
}

.generic-landscape {
height: auto;
width: 95%; /* or as desired */
}

.generic-big-portrait {
height:95%; /* or as desired */
width: auto;
}

.generic-small-portrait {
height:33%; /* or as desired */
width: auto;
}
Quoth is offline   Reply With Quote