- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Float List Items to the right with CSS
To float the list items to the right, use float: right property in CSS. You can try to run the following code to implement it,
Example
<!DOCTYPE html> <html> <head> <style> ul { list-style-type: none; margin: 0; padding: 0; } li { float: left; } li a { display: block; padding: 8px; background-color: orange; } </style> </head> <body> <ul> <li><a href = "#home">Home</a></li> <li><a href = "#news">News</a></li> <li style = "float:right"><a href = "#contact">Contact</a></li> <li style = "float:right"><a href = "#about">About</a></li> </ul> </body> </html>
Advertisements