Home > front end >  For stationary positioning later because the width is adaptive hundred top 0 left 12 px
For stationary positioning later because the width is adaptive hundred top 0 left 12 px

Time:10-26

Because want to locate later can show the distance of the 12 px on both sides, but whether it's on the right margin - left 12 px, or padding - left 12 px, border - left 12 px () sets a color and background color) can't show to consult a great god what to do?

CodePudding user response:

Had better give a specific example code, according to my experience, probably there are two ideas: 1.
 box - sizing: border - box; 
add padding or a border; 2. Is to use absolute layout (position: absolute) or fixed layout (position: fixed) left and right

CodePudding user response:

The box - sizing: content - box; The default model width=content
Is outside of the box is too small can't display

The box - sizing: border - box; Width=content + padding + border
Try using the following

CodePudding user response:

Sorry, didn't see the title, if a fixed position, under normal circumstances this setting should be able to normal display 2 padding on the side of, if you don't send the code to see?
The fixed {
Position: fixed;
Top: 0 px;
Left: 12 px;
Padding: 5 px 12 px;
Background - color: skyblue;
}
Such as normal so you can show you want.
  • Related