Languages
[Edit]
EN

CSS - outline with padding and radius

5 points
Created by:
May87
427

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>
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