Padding and inner borders
P粉448130258
P粉448130258 2023-08-17 12:46:37
0
1
523
<p>Basically, I have two boxes, one inside the other. For the outer box, I set the padding of all inner text to 10px, but the inner box's borders don't seem to obey this rule. </p> <pre class="brush:php;toolbar:false;">.plan { display: block; margin: 20px 20%; width: auto; border: 2px solid; border-radius: 5px; } .plan * { text-decoration: none; padding: 0px 10px; } .plan * .description { border: 2px solid black; }</pre> <p>Isn't there a way to force the inner border to start 10px from the right of the outer border? </p>
P粉448130258
P粉448130258

reply all(1)
P粉314915922
.plan {
    display: block;
    margin: 20px 20%;
    width: auto;
    border: 2px solid;
    border-radius: 5px;
    padding-right: 10px; /* İçeriğin sağ tarafına 10px boşluk ekler */
    box-sizing: border-box; /* İçeriğin kutu modelini sınırlar */
}

.plan * {
    text-decoration: none;
    padding: 0px 10px;
}

.plan .description {
    border: 2px solid black;
    margin-right: 10px; /* İç kenarlığı dış sınırdan 10px sağda başlatır */
}

In the above code snippet, the padding-right attribute is used to add 10 pixels of space to the right of the content of the .plan class, and the margin-right attribute is given by the .description class to make the inner margin to the right of the outer border Start 10 px from the side. Additionally, using box-sizing: border-box; helps constrain the content and borders to the width of the outer box.

With these adjustments, hopefully this helps you achieve creating a 10 pixel margin on the content of the inner box.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template