I have this code
a {
text-decoration: none;
color: black
}
* {
margin: 0;
padding: 0;
}
[data-content="curso"] {
display: grid;
grid-template-columns: 87px 1fr 10ex;
grid-template-rows: minmax(min-content, 45px) 1fr 18px;
grid-template-areas: "simb title title""simb subtitle subtitle"". . price";
padding: 0;
width: 340px;
height: 120px
}
[data-curso="title"] {
grid-area: title;
color: rgb(41, 48, 59);
margin-left: 7px
}
[data-curso="precio"] {
grid-area: price;
display: grid;
grid-template-columns: 1fr 1fr;
font-size: 18px
}
[data-precio="simb"] {
height: 17px;
}
[data-curso="simb"] {
grid-area: simb;
height: 87px;
width: 87px;
align-self: flex-start;
justify-self: center
}
[data-curso="subtitle"] {
grid-area: subtitle;
color: #686f7a;
margin-left: 7px
}
<a href="" data-content="curso">
<h4 data-curso="title">Mr cat, looking for a job at catching mice</h4>
<h5 data-curso="subtitle">3 years experience catching mice</h5>
<img data-curso="simb" src="http://www.catster.com/wp-content/uploads/2016/05/cats-politics-TN.jpg">
<div data-curso="precio">
<span>1500</span>
</div>
</a>
Everything looks fine until title have fewer letters
a {
text-decoration: none;
color: black
}
* {
margin: 0;
padding: 0;
}
[data-content="curso"] {
display: grid;
grid-template-columns: 87px 1fr 10ex;
grid-template-rows: minmax(min-content, 45px) 1fr 18px;
grid-template-areas: "simb title title""simb subtitle subtitle"". . price";
padding: 0;
width: 340px;
height: 120px
}
[data-curso="title"] {
grid-area: title;
color: rgb(41, 48, 59);
margin-left: 7px
}
[data-curso="precio"] {
grid-area: price;
display: grid;
grid-template-columns: 1fr 1fr;
font-size: 18px
}
[data-precio="simb"] {
height: 17px;
}
[data-curso="simb"] {
grid-area: simb;
height: 87px;
width: 87px;
align-self: flex-start;
justify-self: center
}
[data-curso="subtitle"] {
grid-area: subtitle;
color: #686f7a;
margin-left: 7px
}
<a href="" data-content="curso">
<h4 data-curso="title">Mr cat, looking for a job</h4>
<h5 data-curso="subtitle">3 years experience catching mice</h5>
<img data-curso="simb" src="http://www.catster.com/wp-content/uploads/2016/05/cats-politics-TN.jpg">
<div data-curso="precio">
<span>1500</span>
</div>
</a>
You can see the big space between first row and the second one, this happens even if setting minmax grid-template-rows:minmax(min-content,45px) 1fr 18px;
I don't know what could be wrong, because setting 1fr
should resize with content available, but it looks like minmax(min-content,45px)
is not moving at all. I want the content to resize in order not to see that big space