Skip to content

Commit

Permalink
tweeked floating image style
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Kloos committed Jan 9, 2024
1 parent eff7006 commit afe8b95
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 17 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,23 @@ <h4>Heading 4</h4>
dicta eum facere hic tempore!
</p>
<h5>Heading 5</h5>
<p>This is paragraph text. Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>

<p>
<svg viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg">
<rect width="400" height="300" fill="var(--system-surface-color)"></rect>
<text
x="50%"
y="50%"
dominant-baseline="middle"
text-anchor="middle"
font-family="system-ui"
font-size="2em"
fill="var(--system-gray-text)"
>
Aspect Ratio 4:3
</text></svg
>This is paragraph text. Lorem ipsum dolor sit amet consectetur adipisicing elit.
</p>
<p>
This is more paragraph text. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquid amet
architecto aspernatur atque aut consequuntur dicta dolore eligendi fugit harum labore maxime, nulla
Expand Down
9 changes: 5 additions & 4 deletions src/system-selectors.css
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,14 @@
max-inline-size: 100%;
block-size: auto;
}
main :is(img, picture, svg) {
:is(p, li, td, dd) > :is(img, picture, svg) {
float: inline-end;
margin-inline-start: var(--system-spacing-main-inline);
max-inline-size: 30cqw;
margin-inline-start: var(--system-spacing-column-gap);
margin-block-end: var(--system-spacing-element-block);
max-inline-size: 36cqw;
}
@container --content (width < 42ch) {
main :is(img, picture, svg) {
:is(p, li, dd, td) > :is(img, picture, svg) {
width: 100%;
max-inline-size: unset;
}
Expand Down

0 comments on commit afe8b95

Please sign in to comment.