Home > Web Front-end > CSS Tutorial > How to remove space between inline block elements

How to remove space between inline block elements

藏色散人
Release: 2019-01-17 15:21:39
Original
5178 people have browsed it

To remove spaces between inline block elements, you can use the margin-right attribute. This property is used to remove the space between elements to their right. This property generates negative values ​​to keep elements close to their neighbors.

How to remove space between inline block elements

Syntax:

element { 
    margin-right:value;
 }
Copy after login

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>
Copy after login

The output is as follows:

How to remove space between inline block elements

Supported browsers: The browsers supported by the CSS margin property are as follows:

Apple Safari 3.1

Google Chrome 4.0

Firefox 3.0

Opera 7.6

Internet Explorer 8.0

The above is the detailed content of How to remove space between inline block elements. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template