inline-block

The inline-block elements have both block and inline characteristics. The outside of the box is treated like an inline element. Therefore there is no breaks before and after. The inside of the box is treated like a block element, and properties such as width, height, and margin are applied.

 
<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title> 
        <style type="text/css"> 
            p { 
                display: inline; 
            } 
            span { 
                display: inline-block; 
                border: medium double black; 
                margin: 2em; 
                width: 10em; 
                height: 2em; 
            } 
         </style> 
    </head> 
    <body> 
        <p> 
            HyperText Markup Language (HTML) is the main markup language for 
            displaying web pages and other information that can be displayed 
            in a web browser(From From Wikipedia, the free encyclopedia).
        </p> 
        <p> 
            HyperText Markup Language <span>(HTML)</span> is the main markup language for 
            displaying web pages and other information that can be displayed 
            in a web browser(From From Wikipedia, the free encyclopedia).
        </p> 
    </body> 
</html>
  
Click to view the demo
Home 
  HTML CSS Book 
    CSS  

display:
  1. Block-Level Elements
  2. Inline-Level Elements
  3. inline-block
  4. Run-In Elements
  5. Hiding Elements
Related: