Weird behavior
I'm experiencing a strange behavior that I can't attribute to anything other than perhaps a glitch with a new version? :confused:
I'm setting up a site that uses a widget above the main content area. I have done this a million times, only this time the text widget's margins don't push out its containing div as they should The best way to explain this is to show you (look for a widget containing text "Rather strange behavior...") Basically, the margins of this div don't push out the containing div outwards, but the adjacent ones do get bumped, so there is weird transparent empty space that should be filled with a background color instead EDIT: Just realized I shoudl have posted this in the widgets forum. My bad! I'd repost it there, but I don't think the forum has a delete button to get rid of this one |
there are several div's involved. Add the following to your CSS to see
HTML Code:
#horizontal_custom_widget_area {border: solid 1px red;} |
Thanks JD, that's how I started out, but I wasn't able to find anything wrong with it
I did fail to mention one thing in my original post - when I add the border to the div tag, the widget "wakes up" and reveals its full size (hence my suspicion something is up with the new release - earlier version didn't do that). Remove the border and the fill goes AWOL The last resort will be to add a white border, so at least I have a workaround. It's just that a puzzle like this is something that really tingles my OCD senses and I just can't leave it alone 'till I figure it out :-P You can even test turning the three borders off in firebug - I left them in there for anyone that likes their OCD senses scratched too http://img822.imageshack.us/img822/5...925919fdf0.png |
When I looked at the original post it appeared that adding a white background to the header element would fix the issue.
|
I just re-read the post and margins on a child will not make it's parent div any larger. It may expand beyond the boundarys of the parent but never make the parent bigger.
create a post with the following HTML Code:
<div id="A"> HTML Code:
#A {height: 100px; width: 100px; border: solid 1px red;} |
@Larry, thanks for your input bro. I tried that, but nada.
@Juggledad, the parent div doesn't have its height set in stone like that example does, so it should resize. In fact, id does resize when a border is applied on a child element (as it currently is). The worst thing is that I have used this exact same method on a bunch of sites in the past and it worked every time. I'm totally baffled |
the parent element width doesn't resize, but the height will. can you show me an example where the width has been resized?
|
Height was exactly what I was talking about, the width was never an issue.
Basically, with the border off, the div pushes away the divs above and below away, but it doesn't expand the div that contains it. Hence the empty space between it. Turn the border on, and suddenly the containing div's "walls" get pushed to fill that space (tip of the arrows in the image above is right on the area I'm talking about) |
Quote:
Quote:
When I go to the site and use FireBug in FireFox, if I change the magrin, the height changes. Now the reason you see white behind it is because you have this code HTML Code:
<div id="horizontal_custom_widget_area"> HTML Code:
div#horizontal_custom_widget_area { |
I'm probably not explaining the problem properly
Here is a quick video clip that will illustrate what the funky stuff is :-P http://1ot.us/juggledad |
I understand your issue and the way I would have done what you want without putting a border in is use something like the following. Margins won't "push out" the borders of an element. They just move them away from an adjoining element.
HTML Code:
#text-3 .textwidget { |
I see it now, and here is what I would do, set the border for horizontal_custom_widget_area to s
HTML Code:
#horizontal_custom_widget_area { |
Quote:
Quote:
Great solution, by the way. Unfortunately there is no way to target that div except by its #text-3 css address, which changes every time the client inserts a different text widget. Good ide though! Thanks! |
You could try setting overflow:auto on the containing div. In my tests margin on an inner div does not, by default, affect the the outer div
|
No luck again. Tried it on all divs - nada. It's puzzling to say the least
I'm sure one day I'll figure it out, but I capitulate this time. I'm simply gonna go with the white border Thanks for your help though. |
All times are GMT -6. The time now is 07:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.