<?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: Tamizh K</title>
    <description>The latest articles on DEV Community by Tamizh K (@tamizh_k_e988ae0908c352ae).</description>
    <link>https://dev.to/tamizh_k_e988ae0908c352ae</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4022029%2F94e4e0d1-7263-4ed0-a00c-2792bc2a285c.jpg</url>
      <title>DEV Community: Tamizh K</title>
      <link>https://dev.to/tamizh_k_e988ae0908c352ae</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tamizh_k_e988ae0908c352ae"/>
    <language>en</language>
    <item>
      <title>CSS Position</title>
      <dc:creator>Tamizh K</dc:creator>
      <pubDate>Wed, 05 Aug 2026 07:43:06 +0000</pubDate>
      <link>https://dev.to/tamizh_k_e988ae0908c352ae/css-position-30pb</link>
      <guid>https://dev.to/tamizh_k_e988ae0908c352ae/css-position-30pb</guid>
      <description>&lt;h1&gt;
  
  
  CSS Position: The Property That Changed the Way I Build Web Pages
&lt;/h1&gt;

&lt;p&gt;When I first started learning CSS, I thought designing a webpage was just about changing colors, fonts, and spacing. Everything seemed easy until I wanted to place an element exactly where I wanted it. That's when I came across the &lt;strong&gt;position&lt;/strong&gt; property.&lt;/p&gt;

&lt;p&gt;At first, I didn't understand the difference between &lt;code&gt;relative&lt;/code&gt;, &lt;code&gt;absolute&lt;/code&gt;, &lt;code&gt;fixed&lt;/code&gt;, and &lt;code&gt;sticky&lt;/code&gt;. They all sounded similar, and I often used the wrong one. But after practicing with small projects, I realized that each position value has its own purpose. Once I understood them, creating layouts became much easier.&lt;/p&gt;

&lt;p&gt;In this blog, I'll explain CSS positioning in the same simple way that helped me understand it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the CSS Position Property?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;position&lt;/code&gt; property tells the browser how an element should be placed on a webpage. It also decides whether properties like &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, &lt;code&gt;bottom&lt;/code&gt;, and &lt;code&gt;left&lt;/code&gt; can be used to move the element.&lt;/p&gt;

&lt;p&gt;CSS provides five types of positioning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static&lt;/li&gt;
&lt;li&gt;Relative&lt;/li&gt;
&lt;li&gt;Absolute&lt;/li&gt;
&lt;li&gt;Fixed&lt;/li&gt;
&lt;li&gt;Sticky&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's look at each one with simple explanations.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Static Position
&lt;/h2&gt;

&lt;p&gt;This is the default position for every HTML element. If you don't write any &lt;code&gt;position&lt;/code&gt; property, the browser automatically uses &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Elements appear in the normal order from top to bottom. Even if you try to use &lt;code&gt;top&lt;/code&gt; or &lt;code&gt;left&lt;/code&gt;, nothing will happen because those properties don't work with static positioning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.box&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;static&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;h3&gt;
  
  
  When should you use it?
&lt;/h3&gt;

&lt;p&gt;Honestly, most of the time you don't even have to think about it. If your webpage looks fine without moving elements around, static positioning is enough.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Relative Position
&lt;/h2&gt;

&lt;p&gt;Relative positioning was the first one that actually made sense to me.&lt;/p&gt;

&lt;p&gt;When you use &lt;code&gt;position: relative&lt;/code&gt;, the element stays in its original place, but you can move it using &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;left&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, or &lt;code&gt;bottom&lt;/code&gt;. Even after moving it, the browser still remembers its original space.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.box&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;relative&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;20px&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;30px&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;h3&gt;
  
  
  Think of it like this
&lt;/h3&gt;

&lt;p&gt;Imagine your chair is in your room. You drag it a little to the right, but everyone still remembers where the chair originally belonged. That's exactly how relative positioning works.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common uses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Adjusting the position of buttons or icons&lt;/li&gt;
&lt;li&gt;Creating a parent element for absolute positioning&lt;/li&gt;
&lt;li&gt;Making small layout changes without affecting other elements&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Absolute Position
&lt;/h2&gt;

&lt;p&gt;This was the most confusing position for me in the beginning.&lt;/p&gt;

&lt;p&gt;An absolutely positioned element leaves the normal document flow. Instead of following the regular layout, it is positioned relative to its nearest parent that has a position other than &lt;code&gt;static&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If there isn't one, the element is positioned relative to the entire page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.parent&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;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.child&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="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&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;When I first forgot to add &lt;code&gt;position: relative&lt;/code&gt; to the parent, my element suddenly jumped to the corner of the webpage. That's a mistake almost every beginner makes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common uses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Notification badges&lt;/li&gt;
&lt;li&gt;Icons inside input boxes&lt;/li&gt;
&lt;li&gt;Text on images&lt;/li&gt;
&lt;li&gt;Pop-up elements&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Fixed Position
&lt;/h2&gt;

&lt;p&gt;Fixed positioning is one of the easiest to understand.&lt;/p&gt;

&lt;p&gt;A fixed element stays in the same place on the screen, even when the user scrolls the page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.help-button&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;fixed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&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;You have probably seen this on many websites.&lt;/p&gt;

&lt;p&gt;A WhatsApp chat button, a "Back to Top" button, or a customer support icon usually stays in one place while you scroll. That's because it uses fixed positioning.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Sticky Position
&lt;/h2&gt;

&lt;p&gt;Sticky positioning feels like a combination of relative and fixed.&lt;/p&gt;

&lt;p&gt;At first, the element behaves normally. Once you scroll to a certain point, it sticks to the top of the screen and stays there until its parent section ends.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.header&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="n"&gt;sticky&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;0&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;This is commonly used for navigation bars because users can always see the menu while reading a long page.&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding Top, Right, Bottom, and Left
&lt;/h2&gt;

&lt;p&gt;These properties help move positioned elements.&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;.box&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="nl"&gt;top&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;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;40px&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;ul&gt;
&lt;li&gt;
&lt;code&gt;top&lt;/code&gt; moves the element down from the top.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bottom&lt;/code&gt; moves it up from the bottom.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;left&lt;/code&gt; moves it right from the left edge.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;right&lt;/code&gt; moves it left from the right edge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These properties won't work if the element uses &lt;code&gt;position: static&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Biggest Mistakes While Learning Position
&lt;/h2&gt;

&lt;p&gt;Like many beginners, I made a few mistakes.&lt;/p&gt;

&lt;p&gt;The first mistake was trying to use &lt;code&gt;top&lt;/code&gt; and &lt;code&gt;left&lt;/code&gt; with static positioning. I kept wondering why nothing changed.&lt;/p&gt;

&lt;p&gt;The second mistake was forgetting to give the parent element &lt;code&gt;position: relative&lt;/code&gt; before using &lt;code&gt;position: absolute&lt;/code&gt; on the child. Because of that, my element appeared in completely unexpected places.&lt;/p&gt;

&lt;p&gt;I also tried to build entire page layouts using only absolute positioning. Later I learned that &lt;strong&gt;Flexbox&lt;/strong&gt; and &lt;strong&gt;CSS Grid&lt;/strong&gt; are much better choices for creating responsive layouts.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Should You Use Each Position?
&lt;/h2&gt;

&lt;p&gt;Here's the simple rule I follow now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;Static&lt;/strong&gt; for normal content.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Relative&lt;/strong&gt; when you need to move an element slightly or create a reference for child elements.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Absolute&lt;/strong&gt; for badges, overlays, and icons.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Fixed&lt;/strong&gt; for floating buttons and permanent navigation.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Sticky&lt;/strong&gt; for menus or headers that should stay visible while scrolling.&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>css</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>HTML Attributes</title>
      <dc:creator>Tamizh K</dc:creator>
      <pubDate>Wed, 15 Jul 2026 09:36:59 +0000</pubDate>
      <link>https://dev.to/tamizh_k_e988ae0908c352ae/html-attributes-2e64</link>
      <guid>https://dev.to/tamizh_k_e988ae0908c352ae/html-attributes-2e64</guid>
      <description>&lt;p&gt;&lt;strong&gt;Getting Comfortable with HTML Attributes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When I first started learning HTML, attributes felt like tiny details hiding inside the tags. I understood the basic structure of a webpage, but I didn’t fully understand why some elements had extra words like href, src, or alt.&lt;/p&gt;

&lt;p&gt;Over time, I realized attributes are what make HTML elements useful. They add meaning, behavior, and context. Without attributes, a webpage would still have structure, but it would feel limited and incomplete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What HTML attributes really do&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An HTML attribute gives extra information about an HTML element. It is written inside the opening tag and usually has a name and a value.&lt;/p&gt;

&lt;p&gt;In simple words, the tag creates the element, and the attribute explains something about that element.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Here, href tells the browser where the link should go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why attributes matter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Attributes may look small, but they make a big difference in how a webpage works. They can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Connect one page to another using links.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display images, videos, and other media.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improve accessibility for users and screen readers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Help CSS and JavaScript identify elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Control forms, buttons, and user input.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without attributes, HTML would only show content. Attributes help that content become interactive and meaningful. &lt;/p&gt;

&lt;h2&gt;
  
  
  Some attributes I use all the time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;href for links&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The href attribute is used with anchor tags. It tells the browser the destination of the link.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;src for images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The src attribute gives the path to an image, video, or audio file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;alt for accessibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The alt attribute describes an image. It is helpful when the image does not load and also important for screen readers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;id and class for styling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;id gives a unique name to an element, while class is used when multiple elements share the same styling or behavior.&lt;/p&gt;

&lt;p&gt;placeholder and required in forms&lt;/p&gt;

&lt;p&gt;These attributes make forms easier for users to understand and complete.&lt;/p&gt;

&lt;h2&gt;
  
  
  A few habits that helped me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use lowercase attribute names. It keeps the code cleaner and easier to read.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Put attribute values inside double quotes. This is the common and recommended style.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always write meaningful alt text for images. It improves accessibility and user experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use id only for unique elements. If several elements need the same styling, use class instead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid too much inline style. External CSS is usually easier to manage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What Happens If We Don't Use HTML Attributes?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HTML attributes may seem like small additions, but they play a major role in how a webpage works. Without attributes, HTML elements lose much of their functionality and flexibility.&lt;/p&gt;

&lt;p&gt;For example, if you create a link without the href attribute, the text will appear on the page, but clicking it won't take the user anywhere. Similarly, an image without the src attribute cannot display because the browser doesn't know which image to load.&lt;/p&gt;

&lt;p&gt;Attributes also improve user experience. Without the placeholder attribute, input fields won't show helpful hint text. Without the required attribute, users can submit forms without filling in important information.Accessibility is another area that is affected. If you don't use the alt attribute for images, screen readers cannot describe the image to visually impaired users, making your website less accessible.&lt;/p&gt;

&lt;p&gt;In addition, CSS and JavaScript often rely on attributes like id and class to style elements or add interactivity. Without them, it becomes much harder to design and control your webpage.&lt;/p&gt;

</description>
      <category>html</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
