0

I need to create something like this in Html + CSS.

Box/Container with rounded corners inside

I think it's possible to make it in at least 2 ways:

1) Create the box with 4 rectangles and 4 rounded corners (it's more code, but it will be easy to fix position if I want to scroll background content).

2) Just create a background with that color and create a container in the center with scroll javascript in that div.

WWYD or is there another easier way?

P.S. On top of page, logo (left), buttons/pictograms (center) and profile (right) - I might add another container for it.

ssc-hrep3
  • 15,024
  • 7
  • 48
  • 87
JustAsking
  • 27
  • 4

2 Answers2

0

You can simply use 2 divs with a border and radius for the inner one. See here:

#inside {
  border: 5px solid grey;
  padding: 10px;
  border-radius: 25px;
  height: 200px;
  background: grey;
}

#outside {
  border: 5px solid grey;
  padding: 10px;
  background: black;
}
<div id="outside">
  <div id="inside">
  </div>
</div>
John
  • 5,132
  • 1
  • 6
  • 17
0

if you do not want to use 2 DOM use pseudo element :before

body{
padding: 15px;
}
div{
height:120px;
width:150px;
background-color:black;
border-radius:20px;
position:relative;
}

div:before{
    content: '';
    position: absolute;
    height: 126%;
    width: 120%;
    background-color: red;
    z-index: -1;
    position: absolute;
    top: -13%;
    left: -10%;
}
<div></div>
לבני מלכה
  • 15,925
  • 2
  • 23
  • 47