mardi 27 janvier 2015

How to make a dynamic ascii horizontal divider?


In place of something like a horizontal rule or div border, I'd like to do something like this:


My Title

/*----------------------*/

My content


Notice how the divider between the Title and content is literally a slash, asterix, dashes, and then an asterix and slash to end (it's supposed to look like code).


I'm curious how I could achieve this effect on a fluid layout, with the divider stretching to fill the whole width of the div. Also, I'd like to not use any art for this. Just using ascii would be perfect.


Summary: How can I create a dynamically resizing custom ascii divider? I'm pressuming this will probably have to be done mostly in Javascript and then polling the width of the div everytime the window is resized, and then calculating the length of characters (it's a monospace font) required to fill that space. Is this on the right track?





Aucun commentaire:

Enregistrer un commentaire