Home HTML How to Add HTML Space Between Buttons

How to Add HTML Space Between Buttons

How to Add HTML Space Between Buttons

Here simple post helps you out to know or to add HTML space between buttons by using CSS, or function command.

The difference between buttons is important. The text you place on one will determine its appearance and function.

So it’s best to keep things separate by adding some HTML space between each button element for an eye-catching design!


How to Add HTML Space Between Buttons?

A button with an HTML code. The text will change every day and it’s up to you what message or design goes on top!

There are four ways to add HTML space between two buttons are following:

The most common code that may help in many cases would like:


<div>Button 1</div> <p>Button 2 </div>

In the above example, you can replace the tag of span, button, div, etc.

Margin attribute

Set the margin for all four sides of an <p> element to 35 pixels:

p {
margin: 35px;

Style direct in HTML tag

The <style> Element is use to apply a simple stylesheet an HTML document:

Inline styles are not commonly used some people use and apply the unique style rules, by putting the CSS rules directly into the start tag. It can be attached to an element using the style attribute.

The following example demonstrates how to set the margin of all text:

<h4 style="margin: 10px; margin-left: 20px;">This call Heading<;/h4>
<p style="margin-top: 10px; margin-bottom: 30px;">This is Paragraph</p>

Using Div

The Margin properties of CSS are commonly used for creating spaces between two elements.

<style type="text/css">


margin-top: 10px;

margin-right: 10px;

margin-bottom: 10px;

margin-left: 10px;


Read more: 4 Ways to Bring Your Text To the Center Using HTML

How to Give vertical space between two buttons in html

Here’s example

.button-set {
margin-left: auto; margin-right: auto; }
.button {
float: left; width: 100px; height: 25px; line-height: 25px; font-size: 18px; text-align: center; background-color:#bada55; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.075); }
.button span { display: inline-block;}

<div class="button-set">
<div class="button">Red</div>
<span class="button">Blue</span></div>


Please enter your comment!
Please enter your name here