Skip to content
WJunction - Webmaster Forum

Newbie question: how to align to right?

Status
Not open for further replies.
Hello guys,

Can someone of you can help me with a little issue?

I added facebook and twitter in my header as you can see here:
ZZ6GB.png


But I don't know how to add a space between the two images...
I used <div align right, so I cant give a space...

Any idea how to solve this?

My current code:
PHP:
<div align="right">
<a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/twitter.png" alt="picture of a pumpkin" align=right></a>
<a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/facebook.png" alt="picture of a pumpkin" align=right></a>
</div>

Thanks :)
 

8 comments

<div align="right">
<
a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/twitter.png" alt="picture of a pumpkin" align=right></a>
&nbsp;<a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/facebook.png" alt="picture of a pumpkin" align=right></a>
</
div>
 
try this

<div style="float:right;margin-left:5px;">
<
a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/twitter.png" alt="picture of a pumpkin" ></a>
<
a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/facebook.png" alt="picture of a pumpkin"></a>
</
div>
 
Um you have way too many aligns. Here's the quick fix.

This works because your div is aligned to the right (that's the container for your pics).
You just want a space between twitter and facebook so adjust the CSS margins.
This code will put Twitter<5pixel space>Facebook

Code:
<div align="right"> 
<a href="#"><img style="margin:0 5px"  src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/twitter.png" alt="picture of a pumpkin" ></a>
<a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/facebook.png" alt="picture of a pumpkin" ></a> 
</div>
 
give your div an id and use padding.
HTML:
PHP:
<div id="social"> 
<a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/twitter.png" alt="picture of a pumpkin" /></a> 
<a href="#"><img src="http://givingcancerthefinger.com/wp-content/plugins/social-sharing-toolkit/images/icons_medium/facebook.png" alt="picture of a pumpkin" /></a> 
</div>

CSS:
PHP:
#social img { padding: 0 4px;}
 
Last edited:
dont do in-line styling on the actual div it just gets messy use the CSS file and do your styling in there

margin/padding will solve your problem out. This needs to be applied on the img
 
Status
Not open for further replies.

About the author

D
Active Member · Joined
806
Messages
18
Reactions
18
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom