-2

I'm trying to make a div that includes a paragraph inside it, and my target is that when there is an overflow because of the paragraph content, I'll be able to scroll down so the paragraph won't get out of the DIV. My problem is that the div only scrolls to it's width and not to it's height.

That's what I've already tried:

.taskParagraph {
  font-size: 0.4cm;
  color: black;
  overflow-x: scroll;
}
Penny Liu
  • 15,447
  • 5
  • 79
  • 98
SahiBalata
  • 313
  • 2
  • 5
  • 13
  • 3
    Possible duplicate of [Making a div vertically scrollable using CSS](https://stackoverflow.com/questions/9707397/making-a-div-vertically-scrollable-using-css) – AdityaSrivast Sep 02 '19 at 07:16

4 Answers4

0

Since you didn't provide us much informations I guess you have problem in overflow-x: scroll;, change it to overflow: scroll;

TOMBA
  • 205
  • 1
  • 11
  • As you can see at the link down here it still act the same: https://i.ibb.co/FWDjCYJ/image.png it only scrolls to the width (x). – SahiBalata Sep 02 '19 at 07:19
0

Because you only use overflow-x it takes horizontal overflow. Try to use overflow: scroll; or you can give both overflow-x and overflow-y to scroll.

Pushprajsinh Chudasama
  • 7,772
  • 4
  • 20
  • 43
0

You need to specify a width and add overflow-y: scroll or change your current overflow-x: scroll; to overflow: scroll (remove -x).

.taskParagraph {
  font-size: 0.4cm;
  color: black;
  overflow-x: scroll;
  overflow-y: scroll;
  width: 400px;
}

Of course, you can change width: 400px; to whatever measurement you want.

Rojo
  • 2,749
  • 1
  • 13
  • 34
0

Just going to spit it out like the other answers: you need to change your overflow-x: none to overflow: none, so both the y and x are able to be scrollable.

Secondly, perhaps it is because your line of text is only one line long. Try adding a <br/>, to test if the overflow: none actually works.

Chris
  • 1,206
  • 2
  • 15
  • 35