Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:14:40+00:00 2026-06-03T07:14:40+00:00

If I have a div with the style overflow: hidden; I found that there

  • 0

If I have a div with the style overflow: hidden; I found that there are times when keyboard actions can cause the div to scroll anyway. And since there are no scrollbars, there is really no way to make the div go back to its original state. Is anything I should do in addition to specifying the style to prevent this?

For example when you select the L with the mouse (in the fiddle) and after that you press the down arrow key while holding down shift (i.e. expanding the selection).

http://jsfiddle.net/PeeHaa/H34mM/

Or another scenario is when there is a textarea in the div: http://jsfiddle.net/h6Bhb/1/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:14:41+00:00Added an answer on June 3, 2026 at 7:14 am

    A simple solution would be to disable text-select in the relevant element. Therefor preventing the possibility to use the arrow keys to select more..

    To prevent tekst select you need to event.preventDefault() in the mousedown event with JS.

    For your fiddle that could look like this in modern standards compliant browsers:

    // give the div an id
    document.getElementById('div').addEventListener('mousedown', function(e) {
        e.preventDefault();
    }, false);​
    

    Edit

    Or as @JimThomas pointed out in the comments you can disable text select using CSS, ofcourse this doesn’t enjoy as much support as the JS solution.
    How to disable text selection highlighting using CSS?

    I couldn’t think of a more graceful or more complete (this doesn’t solve problems you might have with inputs) solution, and I’m not sure if there even is one…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have a box with some short paragraphs: <div style=overflow:hidden> <p>Some text</p>
I have something like the following code: <div style=border:2px black solid;overflow:hidden;> <span style=float:right;> <img
I have this code: <style type=text/css> body > div { height: 260px; overflow: hidden;
I have div with the following css style: width:335px; float:left; overflow:hidden; padding-left:5px; When I
I have the following markup: <div style=overflow:auto;width:500px;height:100px;> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li>
i have this: <div id=parent style=overflow:auto> ... <div id=test>Hello</div> ... </div> My question is:
I have this CSS style that does a rounded corners for div border, but
<div id=parent style=overflow:hidden; position:relative;> <div id=child style=position:absolute;> </div> </div> I need to show child
I have a div of an aeroplane inside parent div with overflow: hidden ,
I have an overflow: hidden div which I am scrolling by allowing the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.