Fabio Viola Fabio Viola - 10 days ago 7
CSS Question

The text inside the DIV is too close to the DIV border

Hello everyone and good evening,

The text inside the DIV is too close to the DIV border. How can I create space so the text is a little bit further from the border?

Thank you so much

Below you can find my css and you can also find an example on my website so you know what I am talking about. Thank you again.

.text {
background-color: #F1F1F1;
width: 600px;
margin: auto;
border: 1px solid #73AD21;
padding-top: -50px;
padding-right: -60px;
padding-bottom: -50px;
padding-left: -20px;
}

pre {
white-space: pre-wrap; /* Since CSS 2.1 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}

Answer

Just give padding: 15px;.

.text {
    background-color: #F1F1F1;
    width: 600px;
    margin: auto;
    border: 1px solid #73AD21;
    padding: 15px;
    }

You can increase the padding as you wish (i.e. padding: 20px).