I’m trying to make a horizontal rule with some text in the middle.
For example:
———————————– my title here —————————–
Is there a way to do that in CSS? Without all the “-” dashes obviously.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is roughly how I’d do it: the line is created by setting a
border-bottomon the containingh2then giving theh2a smallerline-height. The text is then put in a nestedspanwith a non-transparent background.I tested in Chrome only, but there’s no reason it shouldn’t work in other browsers.
JSFiddle: http://jsfiddle.net/7jGHS/