Skip to content

Instantly share code, notes, and snippets.

@csssecrets
Last active July 11, 2022 06:59
Show Gist options
  • Save csssecrets/82eb1575806f6eff9c37 to your computer and use it in GitHub Desktop.
Save csssecrets/82eb1575806f6eff9c37 to your computer and use it in GitHub Desktop.
Intrinsic sizing
/**
* Intrinsic sizing
*/
figure {
max-width: 300px;
max-width: min-content;
margin: auto;
}
figure > img { max-width: inherit }
/* Basic styling */
figure {
padding: 10px;
border: 1px solid silver;
}
<p>Let’s assume we have some text here. Bacon ipsum dolor sit amet turkey veniam shankle, culpa short ribs kevin t-bone occaecat.</p>
<figure>
<img src="http://csssecrets.io/images/adamcatlace.jpg" />
<figcaption>
The great Sir Adam Catlace was named after Countess Ada Lovelace, the first programmer ever.
</figcaption>
</figure>
<p>We also have some more text here. Et laborum venison nostrud, ut veniam sint kielbasa ullamco pancetta.</p>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment