How to remove the space between inline-block elements?
To remove the space between the inline-block element use margin-right property. This property is used to remove the space between their right positioned element. This property generated negative values to remain close to their adjacent element.
Syntax:
element {
margin-right:value;
}
Example:
<!DOCTYPE html> <html> <head> <style> nav a { display: inline-block; margin-right:-4px; background: green; color:white; font-weight:bold; text-decoration:none; } h1 { color:green; } body { text-align:center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>margin-right:-4px;</h2> <nav> <a href="#"> geeks </a> <a href="#"> for </a> <a href="#"> geeks </a> </nav> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers: The browser supported by CSS margin property are listed below:
- Apple Safari 3.1
- Google Chrome 4.0
- Firefox 3.0
- Opera 7.6
- Internet Explorer 8.0
Recommended Posts:
- jQuery | Remove Elements
- PHP | Remove duplicate elements from Array
- Program to remove empty array elements in PHP
- Remove all the child elements of a DOM node in JavaScript
- JavaScript | Remove empty elements from an array
- How to remove multiple elements from array in JavaScript ?
- How to set space between the flexbox ?
- How to add space (" ") after an element using :after selector in CSS ?
- CSS | white-space Property
- Space between two rows in a table using CSS?
- Clone a stack without extra space
- Program to replace every space in a string with hyphen
- How to tab space instead of multiple non-breaking spaces (nbsp)?
- How to make a div fill a remaining horizontal space using CSS?
- D3.js | d3.map.remove() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



