Im trying to work out the best way to present a restaurant menu so that it looks like this on the site:
Item #1…£1.23
Item thats #2…£1.23
Item that could be #3…£1.23
First of all I placed the text in a list and floated it left then placed the prices in another list and floated it left also to line them up but I dont think this is correct as if the text has to take up 2 lines then the prices become jumbled.
Anyone any suggestions on how I can present this kind of info properly?
This would be a good case of when to use tables, not only for accessibility but for ease of styling. When you use tables you can set the width of each column and your prices will all line up. You’d only need two columns, one for item name (and wide enough for dots) and the other for the pricing.
In cases like this I’ve used a repeating background for the dots to fill across the width of the item cell and apply the background color to the text (probably needs to be contained in a <span> or <p> tag) so that you don’t get the dots behind your text.
Or you could use the CSS -:after pseudo class if you aren’t really concerned about cross-browser support (it works in IE8 but fails in IE6 and IE7).
The background method would ensure that the dots all line up exactly since the :after pseudo element will start them wherever the text ends.