chiark / gitweb /
CSS: use "background" shorthand property
authorBen Harris <bjh21@bjh21.me.uk>
Thu, 3 Oct 2024 23:06:49 +0000 (00:06 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 3 Oct 2024 23:06:49 +0000 (00:06 +0100)
It's more compact and works just as well.  In fact, I think it might
work better on browsers that support background-image but not
background-size.  On such browsers the entire rule will be ignored,
which is what I want.  If the background image can't appear at
precisely the correct size, it shouldn't appear at all.

Of course, ideally on a browser that fails to display the background,
the title also wouldn't fade out to the left.  I wonder if there's a
sensible way to achieve that.

bedstead.css

index c79403993aec6b0b9a7215dd34b90cf7fe6d13e9..f0c1cce1a7fd3316787e09a35382df111eacce1b 100644 (file)
@@ -32,9 +32,7 @@ h1 {
     margin-top: 0;
     margin-bottom: -0.2em;
     line-height: 1.2em;
-    background-image: url(titlebg.jpg);
-    background-repeat: no-repeat;
-    background-size: auto 100%;
+    background: url(titlebg.jpg) 0% 0% / auto 100% no-repeat;
 }
 
 .fade {