HTML/CSS - Do you know how to create spaces in a web page?
Rules to Better Websites - Layout And Formatting|8f25811e-0bde-4b94-838b-20a7c62c723c
v6.0
Posted at
3/07/2012 12:51 AM by
Tiago Araujo
Rule Intro
There are many scenarios where you need some extra space in a web page. No matter which one you are at, CSS is the answer.
Page Content
Sometimes the first thing that comes to the developer mind is to use the "break line" tag (<br />) or the ASCII character code for "space" ( ) to create these extra spaces. It's wrong. CSS is the way to go. You can use both "margin" or "padding" CSS properties to get the result you want.
<ul>
<li>   List item</li>
</ul>
Figure: Bad Example - Using the "space" ASCII character to create a padding on that list
<ul>
<li>List item</li>
</ul>
<br />
<br />
<br />
Figure: Bad Example - Using the <br /> tag to create a space at the bottom of that list
ul {margin-bottom:15px;}
ul li {padding-left:10px;}
Figure: Good Example - Using CSS to add a margin at the bottom of the list a the padding on the left side of each list item
Tip: You might be not familiar with editing a CSS file. In this case, contact a designer. He/She will be more than happy to help you.
{4586408C-B6A1-40AB-81C4-55DC91D631B1}
Do you feel this rule needs an update?