Within an unordered list:
<li><span></span> The lazy dog.</li> <li><span>AND</span> The lazy cat.</li> <li><span>OR</span> The active goldfish.</li>
Adding a class or style attribute is permitted but padding the text and adding or changing tags is not allowed.
The page is rendering with Courier New.
Goal is to have text after span lined up.
The lazy dog. AND The lazy cat. OR The active goldfish.
Justification of the "OR" is unimportant.
The lazy animal text may be wrapped in an additional element but I'll have to double check.
The main thing to remember about a span element is that it is an inline element, which means that you will not be able to set the width or height of it as is.
To convert it to a fixed-width layout, simply add a fixed with to the #wrapper and set the margins to auto. Setting the margins to auto will cause the left and right margins to be equal no matter how wide the browser window is, which will cause your fixed-width layout to be positioned in the center of the browser.
The <span> tag is an inline container used to mark up a part of a text, or a part of a document. The <span> tag is easily styled by CSS or manipulated with JavaScript using the class or id attribute. The <span> tag is much like the <div> element, but <div> is a block-level element and <span> is an inline element.
span won't have padding because it is an inline element by default, so set inline-block or block.
In an ideal world you'd achieve this simply using the following css
<style type="text/css"> span { display: inline-block; width: 50px; } </style>
This works on all browsers apart from FF2 and below.
Firefox 2 and lower don't support this value. You can use -moz-inline-box, but be aware that it's not the same as inline-block, and it may not work as you expect in some situations.
Quote taken from quirksmode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With