<?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: Shubham Singh</title>
    <description>The latest articles on DEV Community by Shubham Singh (@shubhski).</description>
    <link>https://dev.to/shubhski</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%2F347146%2Fdaedb581-7047-47eb-b958-286641f366bd.jpg</url>
      <title>DEV Community: Shubham Singh</title>
      <link>https://dev.to/shubhski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubhski"/>
    <language>en</language>
    <item>
      <title>5 Unique CSS tricks and properties that you should know </title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Wed, 22 Apr 2020 22:36:10 +0000</pubDate>
      <link>https://dev.to/shubhski/5-unique-css-tricks-and-properties-that-you-should-know-4m4j</link>
      <guid>https://dev.to/shubhski/5-unique-css-tricks-and-properties-that-you-should-know-4m4j</guid>
      <description>&lt;p&gt;CSS is Cascading Style Sheets and used as a way of describing your content on the webpage. It is one of the essential things that every web developer learns. The Level of CSS can be basics, and to show the things you built on the web, you need knowledge of CSS. The looks of the website matter in the eye of viewers.&lt;/p&gt;

&lt;p&gt;Although people think that CSS can only do a few things like giving our HTML code colors, background images, etc. but CSS can do more than that. In the past year, CSS has become powerful and able to create animation, create art, which brings art and life to the stunning website as we saw on the internet.&lt;/p&gt;

&lt;p&gt;Many of us try to learn and master the CSS and learn popular properties. So it is worth it to know some unique properties to CSS that can help you in creating a stunning website.&lt;/p&gt;

&lt;p&gt;In this article, I will talk about a few CSS properties that will change the way of using CSS. Let's Start!!!!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Centering Element using grid
&lt;/h2&gt;

&lt;p&gt;Have you ever struggled with the Centering of your elements on the page? There are many ways to center your elements. In this section, I will go through the easiest one I found for myself. Since the grid Layout Model came in the CSS, It changed the way of making layout and became very popular. But we can also use the grid Box model to change alignment fast and easy. There is a property in the grid by the name place-items Let's take a code example to see this property centering the element because it aligns both horizontally and vertically to center the element since the grid is based on the idea of two-dimension.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhsk88/embed/rNOjerb?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Isn't that easy? I used &lt;code&gt;display: grid&lt;/code&gt;,&lt;code&gt;place-items&lt;/code&gt; in the parent, and it centers the element. &lt;/p&gt;

&lt;h2&gt;
  
  
  2.  3-D Transform
&lt;/h2&gt;

&lt;p&gt;Have you ever thought of giving the third dimension to the element or images? CSS can do much cool stuff like this. These properties also help in creating animation like a card-flip effect. You can rotate your element in 3-D using the perspective, which creates the 3-D space by affecting the distance between Z-plane and user. Let's take the example of code to see the effect in the image.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhsk88/embed/QWjdEbJ?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In the code above, we have given the parent element as the property of &lt;code&gt;perspective&lt;/code&gt; in terms of pixels to give the depth we want from the user. In children, I used the transform property to rotate in the 3-D dimension. You can rotate in the Y direction. Now let's check the possibility of rotating along the X-axis.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhsk88/embed/dyYNXRz?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this case, we can see the posture of our image changed since we change the rotation axis &lt;/p&gt;

&lt;p&gt;Isn't this amazing What can we do with CSS?&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Building Different Shapes using clip-path
&lt;/h2&gt;

&lt;p&gt;Most of the time we want to be creative and want to build some shape like a triangle and star. We start thinking about SVGs, but now you can create these complex shapes in CSS using &lt;code&gt;clip-path&lt;/code&gt; property in CSS which allows you to show the specific region of the element instead of showing the full area. This trick can be beneficial in creating CSS art. Let's take the example of code to see it in action!!&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhsk88/embed/mdeRELK?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this example, I used the clip-path polygon properties. I used the image as a background to cut the specific region and voila you have this excellent shape.&lt;/p&gt;

&lt;p&gt;Stuck with writing those numbers, You can make your own clip-path using&lt;br&gt;
website: &lt;a href="https://bennettfeely.com/clippy/"&gt;Clippy&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Changing the Text-Color using Background-Clip
&lt;/h2&gt;

&lt;p&gt;This property can be excellent if you want to change the color of the text or want to come with a beautiful background in the text. This property clips a background to text and applies that background to the color of the text. To apply that, we need to set the &lt;code&gt;color&lt;/code&gt; property to transparent. Let's take the example of the code to see this property in the action &lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhsk88/embed/vYNgXBz?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;I used the property &lt;code&gt;-webkit-background-clip: text&lt;/code&gt; and set the color to transparent. In my case, I used the background as a linear gradient to change the color of the text. You can use other backgrounds as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Shape-Outside
&lt;/h2&gt;

&lt;p&gt;This is also one of the unique properties in CSS. Sometimes when we want to wrap the text around some circular or some other shape, we get stuck. This property solves this problem, which is &lt;code&gt;shape-outside&lt;/code&gt;. It controls how the element wraps around the floating element. It can take many shapes like a circle, polygon, and even the URL of the image to wrap the text around it. Let's see one example to understand this property&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhsk88/embed/GRprjma?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this example, you can see that We positioned the image element using &lt;code&gt;float&lt;/code&gt; property. We set the value of &lt;code&gt;shape-outside&lt;/code&gt; to the circle at 50%. You can try giving other shapes as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We want to create amazing websites, and sometimes we find to apply these techniques difficult, which can be implemented using the little effort.&lt;/p&gt;

&lt;p&gt;I hope you find this unique tricks and property helpful and hope it will be useful in the future journey. If you find any new CSS tricks, Share your favorite with me in comments and with social media. Feel free to leave a comment&lt;/p&gt;

&lt;p&gt;Thank You and Have a nice day!!!&lt;/p&gt;

</description>
      <category>css</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Guide to Building the Sprite Animation🐕‍🦺</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Mon, 13 Apr 2020 20:18:29 +0000</pubDate>
      <link>https://dev.to/shubhski/the-guide-to-building-the-sprite-animation-2o4k</link>
      <guid>https://dev.to/shubhski/the-guide-to-building-the-sprite-animation-2o4k</guid>
      <description>&lt;p&gt;I was free today on the weekend, so I thought of trying Something new In the CSS. I got the idea from looking at the sprite of the pokemon, and it could be fun to put them in the motion using CSS. Here is how I did it.&lt;/p&gt;

&lt;p&gt;Sprite Animation idea is to putting many images together in a single image and applying the CSS. To make it possible and combining all the images into the single frame, I used the photoshop to put up on the stack and combined it into a single image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here is how it looks
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi4zv4a0k1rko8rihmt79.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi4zv4a0k1rko8rihmt79.jpg" alt="Combined Sprite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wrote the basic HTML as short as possible my content which I was going to uses as a background animation&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;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"sprite"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Animate Using CSS, I used keyframes to define the animation for the user and give the primary position to see the animation. I used the background properties to insert my image in HTML. I fixed the position of the image at   &lt;code&gt;0 0&lt;/code&gt; and used the keyframe, which adjusts my position of the background when it goes from  &lt;code&gt;0% to 100%&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since the height of the image was &lt;code&gt;481px&lt;/code&gt;, and there are 8 images combined in the single image, which sums up to &lt;code&gt;3848px&lt;/code&gt;. Then I applied that animation in my &lt;code&gt;.sprite&lt;/code&gt; class and using the &lt;code&gt;animation-timing-function&lt;/code&gt;. The function allowed me to fix my step to switch the animation since, In my case, there were 8 images, Keep in mind that the no of images you increase in the single image the size increase as well. I wanted to run my animation in the loop So, I used the &lt;code&gt;animation-iteration-count&lt;/code&gt; and set it to &lt;code&gt;infinity&lt;/code&gt; and ran it for 2s which can be chosen as per the needs. Below is the code for the CSS that I used&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="nc"&gt;.sprite&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;547px&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;481px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;block&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="no"&gt;white&lt;/span&gt; &lt;span class="sx"&gt;url(run.png)&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;no-repeat&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;3rem&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;background-position&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;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;background-position&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;-3848px&lt;/span&gt;&lt;span class="p"&gt;;&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;As a result you will get a nice sprite animation which in my case was dog&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9v0xaafrcrf8ioifoqzs.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9v0xaafrcrf8ioifoqzs.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Isn't that awesome way to play with CSS animation 😎😎&lt;/p&gt;




&lt;h2&gt;
  
  
  THANK YOU
&lt;/h2&gt;

</description>
      <category>css</category>
      <category>animation</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
