Sergey Alikin
Sergey Alikin

Reputation: 161

Scroll bar is not padding in <div> with 'overflow' style

I'm very new in frontend world (I did html in 99 year... many changes since that time...) Example of sourse is here: css codehttps://jsfiddle.net/titan83/bm13dqyy/1/ You can see that vertical scrollbar is sticked to top element (combobox). Howewer the table in problem have a right position. How to force scrollbar to be aligned like table? Thanks.

Upvotes: 0

Views: 123

Answers (1)

Supraja Ganji
Supraja Ganji

Reputation: 1207

Got your issue, give margin-top: 10px instead of padding-top: 10px to the div with overflow

      <select id="SGroups" onchange="onSGroupChanged(this.value)" style="width: 100%"></select>
      <div style="height:80vh; overflow: scroll; margin-top: 10px;">
        <table id="worksheetTable">
        <tr><td>1</td></tr>
        <tr><td>2</td></tr>
        <tr><td>3</td></tr>
        <tr><td>4</td></tr>
        </table>
      </div>

Upvotes: 1

Related Questions