Languages
[Edit]
EN

CSS - outline with padding and radius

5 points
Created by:
May87
827

In this article, we would like to show how to create an outline with padding and radius using CSS.

To get outline padding effect we need to use one element nested in the second one.

Outline with padding and radius - CSS
Outline with padding and radius - CSS

Quick solution:

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>
    
    a.outline {
      	padding: 4px;  /*  <----------------------------- required */
       	border-radius: 6px;  /*  <----------------------- required */
        box-shadow: 0px 0px 0px 5px #fff183;  /*  <------ required */
        display: inline-block;
    }
    
    span.content {
    	padding: 2px 5px;
        border-radius: 3px;
      	background: #f7df1e;
        font-family: "Segoe UI";
        font-size: 16px;
        color: black;
      	display: inline-block;
    }

  </style>
</head>
<body>
  <a class="outline">
  	<span class="content">
      #JavaScript
    </span>
  </a>
</body>
</html>

See also

  1. CSS - outline with radius 

Alternative titles

  1. CSS - outline with space and radius
  2. CSS - outline with margin and radius
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join