Languages

CSS - resize property doesn't work

0 points
Asked by:
Saim-Mccullough
718

I'm trying to create resizable element using CSS and the resize property doesn't seem to work. Can you help me with this?

My code:

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>

    .resizable {
        height: 100px;
        width: 100px;
        border: 2px solid;
        border-radius: 5px;
        resize: both; /*   <----- doesn't work   */
    }

  </style>
</head>
<body style="height: 150px;">
  <div class="resizable"></div>
</body>
</html>
1 answer
0 points
Answered by:
Saim-Mccullough
718

Your problem is that you haven't set the overflow property that by default has visible value. Change it to auto or scroll and everything works.

Practical example:

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>

    .resizable {
        height: 100px;
        width: 100px;
        border: 2px solid;
        border-radius: 5px;
        resize: both;
        overflow: auto; /*   or 'scroll'   */
    }

  </style>
</head>
<body style="height: 150px;">
  <div class="resizable"></div>
</body>
</html>
0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join