<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: ahmad-shadeed</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/ahmad-shadeed.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2025-04-03T15:53:52+00:00</updated><author><name>Simon Willison</name></author><entry><title>First look at the modern attr()</title><link href="https://simonwillison.net/2025/Apr/3/first-look-at-the-modern-attr/#atom-tag" rel="alternate"/><published>2025-04-03T15:53:52+00:00</published><updated>2025-04-03T15:53:52+00:00</updated><id>https://simonwillison.net/2025/Apr/3/first-look-at-the-modern-attr/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://ishadeed.com/article/modern-attr/"&gt;First look at the modern attr()&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Chrome 133 (released February 25th 2025) was the first browser to &lt;a href="https://developer.chrome.com/release-notes/133?hl=en#css_advanced_attr_function"&gt;ship support&lt;/a&gt; for the advanced CSS &lt;code&gt;attr()&lt;/code&gt; function (&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/attr"&gt;MDN&lt;/a&gt;), which lets &lt;code&gt;attr()&lt;/code&gt; be used to compose values using types other than strings.&lt;/p&gt;
&lt;p&gt;Ahmad Shadeed explores potential applications of this in detail, trying it out for CSS grid columns, progress bars, background images, animation delays and more.&lt;/p&gt;
&lt;p&gt;I like this example that uses the &lt;code&gt;rows="5"&lt;/code&gt; attribute on a &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; to calculate its &lt;code&gt;max-height&lt;/code&gt; - here wrapped in a feature detection block:&lt;/p&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;@supports&lt;/span&gt; (&lt;span class="pl-c1"&gt;x&lt;/span&gt;&lt;span class="pl-kos"&gt;:&lt;/span&gt; &lt;span class="pl-en"&gt;attr&lt;/span&gt;(x &lt;span class="pl-en"&gt;type&lt;/span&gt;(&lt;span class="pl-c1"&gt;*&lt;/span&gt;))) {
  &lt;span class="pl-ent"&gt;textarea&lt;/span&gt; {
    &lt;span class="pl-c1"&gt;min-height&lt;/span&gt;&lt;span class="pl-kos"&gt;:&lt;/span&gt; &lt;span class="pl-en"&gt;calc&lt;/span&gt;(
      &lt;span class="pl-en"&gt;attr&lt;/span&gt;(rows &lt;span class="pl-en"&gt;type&lt;/span&gt;(&amp;lt;number&lt;span class="pl-c1"&gt;&amp;gt;&lt;/span&gt;)) &lt;span class="pl-c1"&gt;*&lt;/span&gt; &lt;span class="pl-c1"&gt;50&lt;span class="pl-smi"&gt;px&lt;/span&gt;&lt;/span&gt;
    );
  }
}&lt;/pre&gt;

&lt;p&gt;That &lt;code&gt;type(&amp;lt;number&amp;gt;)&lt;/code&gt; is the new syntax.&lt;/p&gt;
&lt;p&gt;Many of Ahmad's examples can be achieved today across all browsers using a slightly more verbose CSS custom property syntax.&lt;/p&gt;
&lt;p&gt;Here are the tracking issues for CSS values support in &lt;code&gt;attr()&lt;/code&gt; for &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=435426"&gt;Firefox&lt;/a&gt; (opened 17 years ago) and &lt;a href="https://bugs.webkit.org/show_bug.cgi?id=26609"&gt;WebKit&lt;/a&gt; (16 years ago).


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/chrome"&gt;chrome&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/web-standards"&gt;web-standards&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/css-custom-properties"&gt;css-custom-properties&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ahmad-shadeed"&gt;ahmad-shadeed&lt;/a&gt;&lt;/p&gt;



</summary><category term="chrome"/><category term="css"/><category term="web-standards"/><category term="css-custom-properties"/><category term="ahmad-shadeed"/></entry><entry><title>Inside the mind of a frontend developer: Hero section</title><link href="https://simonwillison.net/2022/Nov/9/inside-the-mind-of-a-frontend-developer-hero-section/#atom-tag" rel="alternate"/><published>2022-11-09T19:54:54+00:00</published><updated>2022-11-09T19:54:54+00:00</updated><id>https://simonwillison.net/2022/Nov/9/inside-the-mind-of-a-frontend-developer-hero-section/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://ishadeed.com/article/inside-frontend-developer-mind-hero-section/"&gt;Inside the mind of a frontend developer: Hero section&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Ahmad Shadeed provides a fascinating, hyper-detailed breakdown of his approach to implementing a “hero section” component using HTML and CSS, including notes on CSS grids and gradient backgrounds.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ahmad-shadeed"&gt;ahmad-shadeed&lt;/a&gt;&lt;/p&gt;



</summary><category term="css"/><category term="ahmad-shadeed"/></entry><entry><title>Defensive CSS</title><link href="https://simonwillison.net/2022/Jul/6/defensive-css/#atom-tag" rel="alternate"/><published>2022-07-06T17:16:30+00:00</published><updated>2022-07-06T17:16:30+00:00</updated><id>https://simonwillison.net/2022/Jul/6/defensive-css/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://defensivecss.dev/"&gt;Defensive CSS&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Fantastic new site by Ahmad Shadeed describing in detail CSS patterns which can help build layouts that adapt well to unexpected content—things like overly long titles or strange aspect ratio images, common when you are designing against UGC.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://news.ycombinator.com/item?id=31984951"&gt;Hacker News&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/frontend"&gt;frontend&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ahmad-shadeed"&gt;ahmad-shadeed&lt;/a&gt;&lt;/p&gt;



</summary><category term="css"/><category term="frontend"/><category term="ahmad-shadeed"/></entry></feed>