Do not show "overflow" arrows

Asked

Viewed 176 times

3

I own a td with overflow.

<td><div><?php echo $objProg->getagen(); ?></div></td>

Css:

td div {

width:100%; 
height: 30px; 
overflow: auto; 

}

With this CSS above it looks like this:

inserir a descrição da imagem aqui

I would like the arrows on the side of the text to be hidden but the mouse scroll still works to go down and up, there is something that does this ?

4 answers

3


An alternative that I found (I don’t know if the best one, because I never had to do it) would be using a negative margin in the div. For example:

table tbody tr td {
  border:1px solid #ccc;
  overflow: hidden;
}

table tbody tr td div {
  max-height: 40px;
  overflow-y: scroll;
  margin: 0 -20px 0 0;
}

You put overflow: hidden in the parent cell, and controls the scroll in div son, giving her a negative margin, so that it extends beyond the cell. The overflow: hidden in the cell it is important not to let the arrow appear 'outside' of the td.

See working: https://jsfiddle.net/v1ry5rko/

  • +1 . The idea is good, but maybe it is the case to increase the margin and use a padding on the right, in case the person is using a different DPI setting, and the bar is enlarged.

  • You have how to make scrolling "slow" ?

  • If you intend to use only css and html the answer is no. But with javascript (jQuery for example) you can, there are several plugins for this. Look for Smooth scroll (smooth scroll) you find =D

2

Look at my example, I don’t know if I got it right but that’s what I got.

Only when you put the mouse in the div the scroll bars appear.

Link: https://jsfiddle.net/z892h4oc/

  • 1

    That’s not what he wants. The goal would be to never display the scroll bar without removing the scroll function.

1

You can try it here:

::-webkit-scrollbar {
width: 0px;
}

Apply this to your div’s td. Good luck.

  • I tried, it didn’t happen.

  • Even if it worked, it would only solve for Webkit.

0

td {
    width: 100%;
    height: 30px;
    overflow: hidden;
}

td div {
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    padding-right: 17px; /* Aumente e diminua esse valor para compatibilidade cross-browser */
}
  • No way, I want to hide these arrows on the side do not want even one to appear just want to scroll with the scroll when put the mouse on top.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.