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 7800533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:40:07+00:00 2026-06-02T00:40:07+00:00

I have a div that is styled with overflow-x: hidden , but I’m finding

  • 0

I have a div that is styled with overflow-x: hidden, but I’m finding that when there is a wider div inside it that contains text, the user can still drag sideways with the mouse to view the hidden text.

I would like to prevent that and make the text truly hidden. This jsfiddle should show what I mean: http://jsfiddle.net/YzsGF/11/ or here is the code:

<div id="outer">
   <div id="inner">
       How can I truly hide the text beyond the margin?
    </div>
</div>
#outer { 
    width: 150px; 
    height: 300px; 
    overflow-x: hidden;
    border: 1px solid black;
}
#inner { 
    width: 300px;
    overflow-x: hidden;
}

Is there a way that I can prevent the user from being able to see the hidden text?

UPDATE: I need overflow-y to work: it’s OK that overflow-x is CSS3 only. It may help to explain the real-life scenario:

  • I have an inner div of a fixed width but unknown length.
  • When it is sufficiently short to fit in the outer div without a y-scrollbar, everything is fine.
  • When the inner div becomes long enough for the outer div to need a y-scrollbar, one appears, but cuts off some of the right-hand content of the inner div. That’s also OK (I left some RH padding deliberately), but what’s not OK is that the user can select the text and drag it sideways, revealing the empty RH padding and hiding some of the text on the LH side.

Any solutions?

  • 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-02T00:40:09+00:00Added an answer on June 2, 2026 at 12:40 am

    You could use the CSS clip property.
    This will clip your text as desired by not showing anything beyond the clipping rectangle, and it will also stop the user from scrolling across.

    #inner { 
    position:absolute;
    clip:rect(0px,150px,150px,0px);
    width: 300px;
    }
    

    Example:

    http://jsfiddle.net/DigitalBiscuits/YzsGF/18/

    Note: you need to specify an absolute positioning for this the clip property to work it seems.

    More Info Here: http://www.w3schools.com/cssref/pr_pos_clip.asp

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

Sidebar

Related Questions

I have a div that contains a ul and in each li there is
I have this CSS style that does a rounded corners for div border, but
I have a div that has it's opacity set to 60. Inside the div,
I have a div that's set to overflow: auto; . This contents of this
I have a div that contains 3 fields You can see the image here
I have a div that contains a paragraph, a list and a right-floated div.
I have some dynamic text contained in a div that is set to whatever
I have some jQuery that hides half a div that contains an image and
I have a content div, that has a header div, which contains two other
I have div with the following css style: width:335px; float:left; overflow:hidden; padding-left:5px; When I

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.