- Subscribe to this message's RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Center horizontal line?
- Mark Message as New
- Bookmark
- Subscribe
- Subscribe to this message's RSS Feed
- Highlight This Message
- Print This Message
- E-mail this Message to a Friend
- Report Abuse to a Moderator
05-17-2012 03:03 PM
Is it possible to center a horizontal line?
<hr style="width:30%">
It should be centered by default, but I can't seem to get it to center.
<div style="text-align:center;"><hr style="display:inline-block; width=30%;" align="center" /></div>
any tricks to get this <hr> to center?
Re: Center horizontal line?
- Mark Message as New
- Bookmark
- Subscribe
- Subscribe to this message's RSS Feed
- Highlight This Message
- Print This Message
- E-mail this Message to a Friend
- Report Abuse to a Moderator
05-17-2012 10:09 PM
The first code will work fine. You just forgot to add the backslash before the closing bracket.
Re: Center horizontal line?
- Mark Message as New
- Bookmark
- Subscribe
- Subscribe to this message's RSS Feed
- Highlight This Message
- Print This Message
- E-mail this Message to a Friend
- Report Abuse to a Moderator
05-18-2012 07:43 PM
I get a line 30% wide, but it's left justified, at least in my NOOK for PC where I'm testing it. I can't get the line to be centered.
Re: Center horizontal line?
- Mark Message as New
- Bookmark
- Subscribe
- Subscribe to this message's RSS Feed
- Highlight This Message
- Print This Message
- E-mail this Message to a Friend
- Report Abuse to a Moderator
05-19-2012 01:48 AM
Every e-reader has certain ways of doing things different like margins and centering. I just played around with different ways of formatting the hr and I found that while I could style it to center in a mobi file at 30%, it would left align after converting to epub when I opened it in Adobe Digital Editions. Now if I took out the 30% and just left the line at the full 100%, it would center just fine.
I also found that in the mobi file the old fashioned html way of doing it:
<hr width="30%">
worked better than with a style:
<hr style="width: 30%" />
Re: Center horizontal line?
- Mark Message as New
- Bookmark
- Subscribe
- Subscribe to this message's RSS Feed
- Highlight This Message
- Print This Message
- E-mail this Message to a Friend
- Report Abuse to a Moderator
05-19-2012 03:25 AM
Somebody just gave me an idea. Instead of setting the percentage of the rule, set left and right margins of the div until you get the rule down to the size you want.