Overflow - space between text and scrollbar

Hi,

I am trying out the overflow attributes of CSS. I’ve noticed that the text gets squashed up right next to the scrollbar, it looks bad and makes it hard to read. Is there a way to set the space between the text and the scrollbar?

Thanks :slight_smile:

1 Like

Try to set a margin or padding for your div.

1 Like

Thanks. I had already tried setting a margin (it didn’t work) but I hadn’t thought to use padding. I tried padding: right; and it worked fine for me.

Thanks :slight_smile:

sorry, but padding: right is not valid CSS. padding can only have a value assigned to it (e.g. 1em, 10px, 5% or whatever).
the reason it worked for you (probably in some specific browser only) is that “right” is somehow re-interpreted into a numeric value.
to make a long speech short, the correct way of doing it would be either using


padding: 10px;

or, if you only want to pad the right-hand side


padding-right: 10px;

1 Like

Another way to do that same trick is:


padding: 0px 0px 5px 0px;

In this case, you can specify all four padding values in a single line. The order is clockwise: top, right, bottom, left.
I officially have been writing too much css lately, I just tried to end a sentence with a semi colon. :wink:

1 Like

yeah sorry, I actually did use padding-right, was late last night when I posted, so I typed it out wrong :slight_smile: