How to Align a Link to the Right side with CSS?

There are various different methods available in CSS that can be used to align a link to the right side. However, the most easiest and commonly used method is to use the text-align property on the parent element.

In this method, all you need to do is put the link i.e. <a> tag inside a div element, and then simply apply text-align: right; on this parent div element.

This will automatically align the link to the right side of the parent container.

See the following example:


   text-align: right;

The above method is only valid if you want to align all the links to the right side of their parent container. But, if you want only a few links align to the right then the above method will not work.

In that case CSS float property would be the best choice. The float property allows you to float the elements to the left or right side based on the available space.

So, if you want to align a link to the right side, you have to simply use float: right;.

See the following example:


    float: right;


  • Manoj Kumar

    Hi, My name is Manoj Kumar. I am a full-stack developer with a passion for creating robust and efficient web applications. I have hands-on experience with a diverse set of technologies, including but not limited to HTML, CSS, JavaScript, TypeScript, Angular, Node.js, Express, React, and MongoDB.

    View all posts