Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query

Status
Not open for further replies.

newbie1983

Programmer
Sep 9, 2003
52
GB
Hi,

I am modifying a website and i would like to know how i can set the spaces between two buttons in html - is there a special attritbute. I know it would be easy in interdev but i can only switch to design view if i remove all the asp script which is scattered all over the page.

Here is what i hope to achieve (obviously the buttons look more nicer on a web page):

i.e button1 button2

at the moment it looks like

button1 button2

Any help is much appreciated

Regards

HP
 
there's quite a lot of ways of doing that...

it sort of depends on how you're currently setting out your buttons...

for a quick answer, you could use styles...

put this in the tag of the 2nd button:
style="position:absolute; left:20px;"

or some other measurements...
 
If you want the buttons to butt up right next to eachother, you need to make sure there is no whitespace between the <input> (or <button>) tags:

Code:
<input type="button" value="button1"><input type="button" value="button2">

A crude but effective way to space them apart is to use one or more &nbsp; (non-breaking space) entities:

Code:
<input type="button" value="button1">&nbsp;&nbsp;<input type="button" value="button2">

for more control you can use CSS:

Code:
<input type="button" value="button1"><input type="button" style="margin-left:20px" value="button2">

-- Chris Hunt
 
Hi !!!

Chris made it very clear when warning about usage of '&nbsp;' let me add to it, please do not fall prey to use of easy '&nbsp;', their behavior differs from browser to browser. If you use &nbsp; the page may look good in Internet explorer or whatever your test browser is, but would behave in uncertain manner in Netscape Navigator and Mozilla.

Regards,
SwapSawe.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top