I finally give up my previous idea... I tried with table but seems to be hard too. I have another idea: A squared div containing:
- the text at the bottom (no percentage) certainly with:
position:absolute;bottom:0;
- the miniature
img-responsive
at the top of caption vertically/horizontally centered (maybedisplay:table-cell;
can help)
I often see solutions with a predefining widht (e.g 30% or so) but I want this to adapt to any width (because they will be different depending of the screen size)
|-------------------| |-------------------|
| | | I |
| | | M |
|p i c t u r e| | A |
| | | G |
| | | E |
|title (caption) | |title (caption) |
|-------------------| |-------------------|
PREVIOUSLY
It's been 3 hours that I'm trying to get what I want, but impossible (checked stackoverflow, bootstrap options, jsfiddle, w3schools and others...)
My problem look somehow simple:
The goal is to get a formatted gallery.
I explain my self: Each "thumbnail" (bootstrap's one) need to be square and contain:
- the thumbnail (max 70% of height, 100% width, vertically and horizontally centered) and need to be fill width or height
- the Title under (30% left, vertically and horizontally centered)
As an image is better than long text I created a Paint Example
I represented 3 column, but the idea is to get as much as i need in a row
I tried to:
- Use a table
- Modify This (because the title isn't vertically-centered in the 30%
- A hack to center but it doesn't work when height is not a px value (can't post more than 2 links)
- and a various other
As a note, I would like to use CSS only, and get Bootstrap on my website.
I hope you understand my problem, and will help me to solve this.
Using the comment below, my code now looks:
<a href="#" class="thumbnail outer" target="_blank">
<div class="inner">
<div style="height:80%; display:flex;">
<img src="src.jpg" class="img-responsive" style="margin:auto;">
</div>
<div class="caption">
<h3 class="text-center">Title</h3>
</div>
</div>
</a>
This works nicely, but vertical image aren't resized correctly. Please give me a hack to allow this (add max-height:100%;
doesn't work"