Connecting Tech Pros Worldwide Help | Site Map

stopping the child control from exceeding parent div element

 
LinkBack Thread Tools Search this Thread
  #1  
Old January 3rd, 2009, 08:40 AM
Newbie
 
Join Date: Dec 2008
Posts: 5
Default stopping the child control from exceeding parent div element

i have a div element with a child control in it which gets populated with data

depending on data teh control expands and also the div. if i set the div width the data overflows in the extended control
i need to use clip property
i tried setting it but i am not getting teh result

clip:rect(0 30 30 0);

how do i set the parent and child element
Reply
  #2  
Old January 3rd, 2009, 02:55 PM
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,280
Default

This is not a html or css question; or at least I don't know what language you are using.
Reply
  #3  
Old January 3rd, 2009, 05:37 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Age: 22
Posts: 3,525
Default

Can we see your code?
It's kind of hard to see the problem without it.

Note, that the clip property won't work if you set the overflow property to "visible".
See how it is supposed to work here.
Reply
  #4  
Old January 3rd, 2009, 06:39 PM
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,280
Default

Oops. Talk about jumping the gun. I wasn't thinking when I made my reply.

As Atli said, we need to see the markup or have a link. We also need to know which browser you are using. 'clip' only works in modern browsers and not IE.
Reply
  #5  
Old January 3rd, 2009, 07:17 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Age: 22
Posts: 3,525
Default

Quote:
Originally Posted by drhowarddrfine View Post
'clip' only works in modern browsers and not IE.
Are you sure?
I just tested a very basic example in both IE6 and IE7 and they both seemed to do fine with it.

Not that it would greatly surprise me if there were some bugs lurking around that I missed.
Reply
  #6  
Old January 3rd, 2009, 08:08 PM
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,280
Default

I did not try it and I've never used it but here is my reference.

EDIT: A place I cannot link to says this:
Quote:
Internet Explorer for Windows versions up to and including 7 do not support the recommended syntax for the rect() notation. However, they do support a deprecated syntax where the arguments are separated by whitespace rather than commas.
Internet Explorer for Windows versions up to and including 7 don’t support the value inherit.
Reply
  #7  
Old January 3rd, 2009, 09:56 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Age: 22
Posts: 3,525
Default

Ok, I see.

After messing around a bit more with my code, I can confirm that quote.
Without the commas, it works with IE6 and IE7, but then it won't validate. If that doesn't bother you, all the other browsers also accept the comma-free version.

However, if you throw IE into quirks-mode (by omitting the doctype, for instance), it suddenly starts working with the standard method.
It's like they are ignoring the standards on purpose...
Reply
  #8  
Old January 3rd, 2009, 10:13 PM
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,280
Default

Quote:
Originally Posted by Atli View Post
It's like they are ignoring the standards on purpose...
Of course they are! Always have. IE is the worst browser on the planet.
Reply
  #9  
Old January 5th, 2009, 01:14 PM
Expert
 
Join Date: Nov 2007
Age: 26
Posts: 126
Default

Try explicitly defining the width and placing an overflow:hidden; CSS propery on the parent element.

Expand|Select|Wrap|Line Numbers
  1. <!-- if this were the parent div -->
  2. <div id="parentDiv" style="width: 500px; overflow:hidden;">
  3.    <[data]>
  4. </div>
  5.  
Reply
Reply

Bookmarks

Tags
child, clip property, div, parent

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.