Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS / JavaScript - content outside a element with overflow:hidden

I have a container div element that has overflow:hidden on it. Unfortunately this property is required on it because of the way the site is made.

Inside this div it's all the site content, including some tooltips. These tooltips are displayed with jQuery when you mouse over a link or something.

The problem is that some of these tooltips will display partially hidden because of the overflow thing above, because they are positioned outside the container div...

Is there any way to be able to show a specific element from inside this container, even if it's out of its boundaries? Maybe a javascript solution?

the html looks like this:

<div style="overflow:hidden; position:relative;">

  the main content

  <div style="position:absolute;left:-100px;top:-50px;"> the tooltip thing </div>

</div>
like image 368
Alex Avatar asked Aug 28 '10 13:08

Alex


People also ask

How do I show content in overflow hidden?

Use overflow: hidden instead. Use overflow-x : scroll and overflow-y : hidden , or overflow: scroll hidden instead. Use overflow-x : hidden and overflow-y : scroll , or overflow: hidden scroll instead.

How will you hide extra text or content that goes outside of the area CSS?

The default value of overflow is visible . With this default, we can see content when it overflows. To crop content when it overflows, you can set overflow: hidden . This does exactly what it says: it hides overflow.

How do you hide elements outside a div?

Here, the area of DIV element is shown by the red border, and we can clearly see that text is going beyond it. We can solve this problem by using CSS overflow property. overflow: hidden; hidden – The overflow is clipped, and the rest of the content will be invisible.

How do you clip the overflowing content from an HTML element?

The overflow property specifies whether to clip the content or to add scrollbars when the content of an element is too big to fit in the specified area. The overflow property has the following values: visible - Default. The overflow is not clipped.


1 Answers

try this:

<div style="position:relative;">    
  <div style="overflow:hidden; position: relative; width: {any}; height: {any};">the main content<div>    
  <div style="position:absolute;left:-100px;top:-50px;"> the tooltip thing </div>    
</div>

just place your main content to another div inside the main div and give provided css to hide the content if overflowing...

like image 68
Vaibhav Gupta Avatar answered Sep 30 '22 13:09

Vaibhav Gupta