- 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
Align elements using the CSS float property
To align elements using the float property in CSS, you can try to run the following code −
Example
<!DOCTYPE html> <html> <head> <style> .demo { float: right; width: 200px; border: 1px dashed blue; padding: 5px; } </style> </head> <body> <h1>Heading</h1> <div class = "demo"> <p>This is demo text and right aligned.</p> </div> </body> </html>
Output
Advertisements