Discussion
Loading...

#Tag

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Roni Rolle Laukkarinen boosted
Ana Tudor 🐯
@anatudor@mastodon.social  ·  activity timestamp 2 days ago

I am begging you, please don't split your heading into two separate `h2` elements with an `img` in between just to have the image in between your heading words.

This is what subgrid was made for!

#CSS #layout #cssLayout #code #coding #web #dev #webDev #webDevelopment

HTML:

```
<!-- ❌ DON'T DO THIS 🚫 -->
<section>
  <h2>Classic</h2>
  <img src='classic-bar.png' alt=''/>
  <h2>Flavour</h2>
</section>

<!-- ✅ DO THIS ✅ -->
<section>
  <h2>
    <span>Classic</span>
    <span>Flavour</span>
  </h2>
  <img src='classic-bar.png' alt='the classic chocolate bar'/>
</section>
```

CSS:

```
section, h2 { display: grid }

section { grid-template-rows: repeat(3, auto) }

h2 {
  grid-area: 1/ 1/ span 3;
  grid-template-rows: subgrid;
  
  span:last-child { grid-row: 3 }
}

img { grid-area: 2/ 1 }
```
HTML: ``` <!-- ❌ DON'T DO THIS 🚫 --> <section> <h2>Classic</h2> <img src='classic-bar.png' alt=''/> <h2>Flavour</h2> </section> <!-- ✅ DO THIS ✅ --> <section> <h2> <span>Classic</span> <span>Flavour</span> </h2> <img src='classic-bar.png' alt='the classic chocolate bar'/> </section> ``` CSS: ``` section, h2 { display: grid } section { grid-template-rows: repeat(3, auto) } h2 { grid-area: 1/ 1/ span 3; grid-template-rows: subgrid; span:last-child { grid-row: 3 } } img { grid-area: 2/ 1 } ```
HTML: ``` <!-- ❌ DON'T DO THIS 🚫 --> <section> <h2>Classic</h2> <img src='classic-bar.png' alt=''/> <h2>Flavour</h2> </section> <!-- ✅ DO THIS ✅ --> <section> <h2> <span>Classic</span> <span>Flavour</span> </h2> <img src='classic-bar.png' alt='the classic chocolate bar'/> </section> ``` CSS: ``` section, h2 { display: grid } section { grid-template-rows: repeat(3, auto) } h2 { grid-area: 1/ 1/ span 3; grid-template-rows: subgrid; span:last-child { grid-row: 3 } } img { grid-area: 2/ 1 } ```
  • Copy link
  • Flag this post
  • Block
Ana Tudor 🐯
@anatudor@mastodon.social  ·  activity timestamp 2 days ago

I am begging you, please don't split your heading into two separate `h2` elements with an `img` in between just to have the image in between your heading words.

This is what subgrid was made for!

#CSS #layout #cssLayout #code #coding #web #dev #webDev #webDevelopment

HTML:

```
<!-- ❌ DON'T DO THIS 🚫 -->
<section>
  <h2>Classic</h2>
  <img src='classic-bar.png' alt=''/>
  <h2>Flavour</h2>
</section>

<!-- ✅ DO THIS ✅ -->
<section>
  <h2>
    <span>Classic</span>
    <span>Flavour</span>
  </h2>
  <img src='classic-bar.png' alt='the classic chocolate bar'/>
</section>
```

CSS:

```
section, h2 { display: grid }

section { grid-template-rows: repeat(3, auto) }

h2 {
  grid-area: 1/ 1/ span 3;
  grid-template-rows: subgrid;
  
  span:last-child { grid-row: 3 }
}

img { grid-area: 2/ 1 }
```
HTML: ``` <!-- ❌ DON'T DO THIS 🚫 --> <section> <h2>Classic</h2> <img src='classic-bar.png' alt=''/> <h2>Flavour</h2> </section> <!-- ✅ DO THIS ✅ --> <section> <h2> <span>Classic</span> <span>Flavour</span> </h2> <img src='classic-bar.png' alt='the classic chocolate bar'/> </section> ``` CSS: ``` section, h2 { display: grid } section { grid-template-rows: repeat(3, auto) } h2 { grid-area: 1/ 1/ span 3; grid-template-rows: subgrid; span:last-child { grid-row: 3 } } img { grid-area: 2/ 1 } ```
HTML: ``` <!-- ❌ DON'T DO THIS 🚫 --> <section> <h2>Classic</h2> <img src='classic-bar.png' alt=''/> <h2>Flavour</h2> </section> <!-- ✅ DO THIS ✅ --> <section> <h2> <span>Classic</span> <span>Flavour</span> </h2> <img src='classic-bar.png' alt='the classic chocolate bar'/> </section> ``` CSS: ``` section, h2 { display: grid } section { grid-template-rows: repeat(3, auto) } h2 { grid-area: 1/ 1/ span 3; grid-template-rows: subgrid; span:last-child { grid-row: 3 } } img { grid-area: 2/ 1 } ```
  • Copy link
  • Flag this post
  • Block
Jen Simmons boosted
Frontend Dogma
@frontenddogma@mas.to  ·  activity timestamp 3 months ago

Item Flow: Next Steps for Masonry, by @jensimmons and @saron.bsky.social ( @webkit):

https://webkit.org/blog/17219/item-flow-part-2-next-steps-for-masonry/

#css #masonry #layout

  • Copy link
  • Flag this post
  • Block
Frontend Dogma
@frontenddogma@mas.to  ·  activity timestamp 3 months ago

Item Flow: Next Steps for Masonry, by @jensimmons and @saron.bsky.social ( @webkit):

https://webkit.org/blog/17219/item-flow-part-2-next-steps-for-masonry/

#css #masonry #layout

  • Copy link
  • Flag this post
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login