Reputation: 8734
i have one div which contains several divs. I changed the parent div width. But because of the divs which are children to the parent div, the width is increasing. i written the css class like this.
$('#s4-workspace').css({
'width': '900px'
});
Here s4-workspace
is the parent div.
After applying the above property and when I see in the IE, the width is increasing to 1600px. I want to apply this width to all the child divs. Is there any method to achieve such functionality in jquery?
i am working in sharepoint designer.
Upvotes: 3
Views: 2845
Reputation: 148110
You can use width() jquery function to set the width by getting children using children() function.
$('#s4-workspace').children().width($('#s4-workspace').width());
Its better to handle it with style sheet instead jquery/javascript. Setting width of children in percentage could do it, like 100%.
Upvotes: 3
Reputation: 16018
of course, if any of those children have borders, or padding, or are floated alongside other floats, this approach won't work. have you identified why those child elements are sizing to 1600?
Upvotes: 3