To create a horizontal divider with text in center using CSS
Q. How to create a horizontal divider with text in center using CSS?
<!DOCTYPE html> <html> <head> <style> .divider { display: flex; align-items: center; text-align: center; margin: 20px 0; } .divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid #ccc; } .divider:not(:empty)::before { margin-right: .25em; } .divider:not(:empty)::after { margin-left: .25em; } </style> </head> <body> <div class="divider">OR</div> </body> </html>
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.