How to make a space in HTML?

schrute

Regular Member
Joined
Oct 14, 2010
Messages
290
Reaction score
16
Instead of using " " to make a space. Is there another way to make a space by pixels? " " provides too big of a space, I need between two images (Adsense code and an image) and I need it to be slightly less.
 
1 method is make an image 1 pixel by 1 pixel (or whatever size you want). make it transparent.
 
Make a transparent(clear) 1 x 1 pixel gif in your favourite image program like photoshop and then size inline. You can set it to any width you want. The image size will be small and download almost instantly.
 
put the image inside a div, then use either the padding or the margin attribute to adjust the div's border size.

use padding-left, margin-left, etc if you just want to add spacing on one side
 
Hi guys,
this is crazy, creating and image only to make a gap? what about this:

PHP:
<html>
<body>
lol<span style="margin-left: 20px;">rofl
</body>
</html>

Tested it and it works.
 
Hi guys,
this is crazy, creating and image only to make a gap? what about this:

PHP:
<html>
<body>
lol<span style="margin-left: 20px;">rofl
</body>
</html>
Tested it and it works.


you should always end your opened tags

PHP:
<html>
<body>
lol<span style="margin-left: 20px;">rofl</span>
</body>
</html>
 
I forgot about this post.

Yeah I found that to be a solution. Does anyone know can I use <span> to change the background between <span> and </span> as well?
 
I forgot about this post.

Yeah I found that to be a solution. Does anyone know can I use <span> to change the background between <span> and </span> as well?

Here you go:
PHP:
<html>
<body>
lol<span style="border-left:20px solid red;"></span>rofl
</body>
</html>


But this might not be what you wanted, span is only 1 line high. Maybe you could use div instead, but its not line element.
 
I forgot about this post.

Yeah I found that to be a solution. Does anyone know can I use <span> to change the background between <span> and </span> as well?

PHP:
<html> 
<body> 
lol<span style="margin-left: 20px;background: #ff0000;">rofl</span> 
</body> 
</html>

for red background.
 
You can use nbsp only otherwise take a dreamweaver and keep space or set blank image there with your background color
 
Make a table and keep cellpadding or cellspacing otherwise whats the harm in using   ?
 
Using Image to create a space is not a good way of approaching from SEO point of view as image makes a webpage heavier so we should try to avoid as much image as possible instead CSS is the solution of all such problems... good luck :)
 
hey Great solution. I love it :) BHW is the best place to learn awesome tricks :)
 
Back
Top