<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ana Martins</title>
    <description>The latest articles on DEV Community by Ana Martins (@anamartins).</description>
    <link>https://dev.to/anamartins</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F441417%2F025d4c29-9c3c-419a-8bce-583fd4340e11.png</url>
      <title>DEV Community: Ana Martins</title>
      <link>https://dev.to/anamartins</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anamartins"/>
    <language>en</language>
    <item>
      <title>What we do with the box-shadows</title>
      <dc:creator>Ana Martins</dc:creator>
      <pubDate>Wed, 25 Dec 2024 12:30:00 +0000</pubDate>
      <link>https://dev.to/anamartins/what-we-do-with-the-box-shadows-3d39</link>
      <guid>https://dev.to/anamartins/what-we-do-with-the-box-shadows-3d39</guid>
      <description>&lt;p&gt;Every now and then I get a "CSS phase". The latest one started when I discovered &lt;a href="https://cssbattle.dev/" rel="noopener noreferrer"&gt;CSSBattle&lt;/a&gt;. This website has daily challenges where you need to reproduce an image with CSS with the least amount of characters. I am horrible, extremely verbose, but I must say I got obsessed.&lt;/p&gt;

&lt;p&gt;One of my favorite things is looking at other people's solutions, and this was how I discovered that my other fellow css-battlers uses &lt;code&gt;box-shadow&lt;/code&gt; a lot there, and then I got super curiours about it. They basically use this property to replicate one retangle forever and ever. I'll show how.&lt;/p&gt;

&lt;h2&gt;
  
  
  The box-shadow property
&lt;/h2&gt;

&lt;p&gt;There are lots of arrangements for this property, according to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;. But the one we use here is &lt;code&gt;top left color&lt;/code&gt;. So, for example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Fcssbattleapp.appspot.com%2Fo%2Fuser%252Fe6YbeBahWNPT7VpE2rE2p85byxa2%252Ftargets%252Ftarget_m3BxAL2%402x.png%3Falt%3Dmedia" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Fcssbattleapp.appspot.com%2Fo%2Fuser%252Fe6YbeBahWNPT7VpE2rE2p85byxa2%252Ftargets%252Ftarget_m3BxAL2%402x.png%3Falt%3Dmedia" width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
(CSSBattle daily target for 16/11/2024)&lt;/p&gt;

&lt;p&gt;In this image we see only one div; the other ones are shadows. So, the html will be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CSS will be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#6592CF&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;52px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;52px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;70px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#EEB850&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
       &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;75px&lt;/span&gt; &lt;span class="m"&gt;#243D83&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;150px&lt;/span&gt; &lt;span class="m"&gt;#EEB850&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="m"&gt;105px&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;#243D83&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;210px&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;#EEB850&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="m"&gt;105px&lt;/span&gt; &lt;span class="m"&gt;75px&lt;/span&gt; &lt;span class="m"&gt;#EEB850&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;210px&lt;/span&gt; &lt;span class="m"&gt;75px&lt;/span&gt; &lt;span class="m"&gt;#243D83&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="m"&gt;105px&lt;/span&gt; &lt;span class="m"&gt;150px&lt;/span&gt; &lt;span class="m"&gt;#243D83&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;210px&lt;/span&gt; &lt;span class="m"&gt;150px&lt;/span&gt; &lt;span class="m"&gt;#EEB850&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the top and left properties are in &lt;code&gt;px&lt;/code&gt;, and the distances are relative to the first one.&lt;/p&gt;

&lt;p&gt;Maybe I'm the only one, but I think that this is very interesting. I'll continue my studies in CSS and I'll let you if I find other cool things.&lt;/p&gt;

</description>
      <category>css</category>
      <category>cssbattle</category>
    </item>
  </channel>
</rss>
