Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Inline" border of a div

Tags:

css

This is what I want to archive:

A green Block with text inside and a kind of inline border

This is my code:

.mybox {
  width: 200px;
  height: 60px;
  background-color: #00483b;
  /* ... and other simple stuff border: THIS IS MY PROBLEM */
}
<div class="mybox">Text Inside</div>

How can I draw a white border around my div? This border should be some pixels inside the box. I am pretty sure that I have seen something like that or am I wrong and that is not possible? How should I proceed then?

like image 919
Stefan Meyer Avatar asked Dec 15 '22 01:12

Stefan Meyer


1 Answers

You can use outline, which draws an additional border outside of the normal border.

.mybox {
  width: 200px;
  height: 60px;
  background-color: #00483b;
  border: 1px solid white;
  outline: 3px solid #00483b;
}
<div class="mybox">Text Inside</div>
like image 156
Tyler Roper Avatar answered Jan 06 '23 13:01

Tyler Roper