W
W
webhero2018-05-06 09:55:25
Layout
webhero, 2018-05-06 09:55:25

How to move the border by a certain distance?

Maybe the question sounded noob, but I really have not come across this yet.
Do you need another container so that the border wraps around it, or are there other ways?
In the picture, I showed in color where the borders should be
5aeea6da154a6770446049.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2018-05-06
@webhero

Everything can be solved with padding:
https://jsfiddle.net/r5hkjeLs/

L
Lara B, 2018-05-06
@Lara164

this is better through a pseudo-element. Your main div, for example
.block {
position: relative;
width: 200px
height:300px;
background-color: #fff;
}
.block::before {
content: "";
z-index: 1;
position: absolute;
width:180px;
height: 280px;
top: 10px;
left: 10px;
border: 2px solid blue; }
Just keep in mind that everything inside the main block will also need to be placed in a separate div and also absolutely positioned with a z-index of 2

I
iminby, 2018-05-06
@iminby

Wrap it in a div and give padding... Why are there pseudo elements?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question