IE7 floats disappear when their parent is position:relative - css

This is a pared down version of a problem I am facing with IE7. In all other (newer) browsers, this displays fine... why does position:relative; have an effect on float: right; or float: left;? Is there a way to keep the position: relative without sacrificing the functionality of float?
JS fiddle: http://jsfiddle.net/uW7JV/2/
Without position: relative;
With position: relative; (on the red box)
Even more trimmed-down version: http://jsfiddle.net/uW7JV/4/
Interesting... Removing the <div class="clearboth"></div> allows the content to show. However, I do need that functionality there, so I'm still looking for a fix. http://jsfiddle.net/uW7JV/9/

You need to add overflow: hidden to .column-wrapper so that it wraps its floating children. You won't need the .clearboth div and CSS at all after you do this.
The other issue you need to solve is column widths, since box-sizing: border-box is not supported in IE7, you need to account for your padding when assigning width.
div {
padding: 5px 1%;
}
.column-wrapper {
background: orange;
position: relative;
overflow: hidden;
}
.main {
background: yellow;
float: right;
width: 64.6%;
}
.sidebar {
float: left;
background: green;
width: 31.3%;
}
DEMO: http://jsfiddle.net/myajouri/uW7JV/15/
Another way to go about this is to use the Clearfix hack
.clearfix {
zoom: 1; /* for IE6/7 */
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
Then add the clearfix class to .column-wrapper.

Related

Responsive Sidebar does not work properly in the smartphone version

I have a problem with sidebar of this page. I can not make it go under in the responsive version, especially in the smartphone version. Sidebar remains attached to the contents of the left but does not wrap
This is the link for the codepen
If codepen does not work, this is the link for the website.
archive-posts-w.with-sidebar .archive-sidebar {
display: block !important;
position: relative;
top: inherit;
left: 0;
width: 100%;
max-width: 350px;
bottom: inherit;
right: inherit;
clear: both;
float: left;
}
Html there will certainly be errors because it is a copy of a source of a website wordpress.
There are a few problems here:
Your container .archive-posts-w.with-sidebar has display: table;. Change that to display: block for smaller screens (i.e. in your media query)
The CSS for the part above your sidebar should be like this (for smaller screens):
.archive-posts-w.with-sidebar .archive-posts {
display: block;
vertical-align: top;
width: 100%;
}
And for .archive-posts-w.with-sidebar .archive-sidebar you have a max-width setting of 350px, also inherited from everal other rules, so change this rule (for smaller screens) to
.archive-posts-w.with-sidebar .archive-sidebar {
display: block !important;
position: relative;
top: inherit;
left: 0;
width: 100%;
max-width: none;/* <-- this one is changed */
bottom: inherit;
right: inherit;
clear: both;
}
First add class table td in that td class="test"
td.test
{
display:block
}
#sb_instagram .sbi_header_text .sbi_bio, #sb_instagram .sbi_header_text h3
{
margin:0px!important;
}
#sb_instagram .sbi_header_text .sbi_bio, #sb_instagram .sbi_header_text h3
In that class you have 'margin: 0 0 0 60px!important;' you change that 0px
abd check the devices
http://www.responsinator.com/?url=http://www.alchimieadv.biz/ricette/&device=ipad&orientation=portrait

Hover is not firing after window resize in Chrome

I'm having an issue with the pseudo-class :hover in Google Chrome.
Basically I have an element that when in :hover state it's sibling is displayed. This works fine.
Then I add a media query so that when the viewport has a specific min-width the element is no longer displayed but the sibling is.
When going from the min-width to a smaller width the display:none on the sibling no longer fires.
It might be easier to understand by taking a look at this example. Try resizing the viewport.
http://jsfiddle.net/5gPGR/1/
HTML
<div id="container">
<div id="trigger">
</div>
<div id="target">
</div>
</div>
CSS
#container {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 80px;
padding: 24px;
line-height: 80px;
background: #777;
box-sizing: border-box;
}
#trigger {
position: absolute;
display: block;
width: 50%;
height: 80px;
top: 0;
right: 0;
background: #275;
}
#target {
position: absolute;
display: none;
width: 50%;
height: 80px;
top: 0;
left: 0;
background: #f57;
}
#trigger:hover ~ #target {
display: block;
}
#media screen and (min-width: 400px) {
#trigger {
display: none;
}
#target {
display: block;
}
}
This is only an issue in Chrome/Chrome Canary. I have tested in the latest versions of:
Chrome
Chrome Canary
FF
IE
Safari
Opera
Is there something I can do to resolve this or do I just need to stick with javascript for these kinds of interfaces.
EDIT:
I forgot to mention that if I force the element state to :hover using chrome dev tools it starts working again until the next resize.
Interesting error, I'm not sure why that happens
I was able to fix the issue by adding an empty #target:hover { }
Demo
If you're using a preprocessor that would remove this line, you can add a property that you already have, like #target:hover { display:block; }

css positioning and order of objects

I'm trying to tweak my site and have been sitting for a bit too long at the computer hence I do not know where my mistake is. Hoping someone could help out a person with basic knowledge of css.
Here is my css:
#body {float: left; width: 100%; min-height:100%;}
#header-wrap,
#slider-wrap,
#content-wrap,
#footer-wrap {
float: left;
clear: both;
width: 100%;
}
#header-wrap {
float: left;
width: 100%;
}
#header {height: 100px;}
#slider {height: 500px;}
#content {padding: 0; text-align: left;}
I wanted to add
position: absolute; top: 0px
to #slider-wrap so that it begins at the top right under the header but when I do that both the #content moves up and is placed directly under the slider?
What is the correct positioning for these objects so that they show in the following order:
1. header
2. slider (partially under the header)
3. content
and on pages with no slider the content should follow the header???
any clues for this noob would be much appreciated
This:
#header-wrap,
#slider-wrap,
#content-wrap,
#footer-wrap {
float: left;
clear: both;
width: 100%;
}
Means that all three rules are applied to all the four specified elements. If you add your position rule there as well it'll apply to all those elements.
Instead, try adding:
#slider-wrap { position: absolute; top: 0px }

Help, IE7 mugged my divs and now they're running off the screen!

My site, http://hivechatter.com/, is super sexy for Firefox, Chrome, IE8, you name it:
But then along comes IE7, who mauls her divs so bad that they nearly run off the screen! And for whatever reason the content within the divs is centered. What the heck is going on here? It seems to be something to do with the way IE7 interprets the left: percentage margins, but I can't figure it out.
For convenience and posterity's sake, below are the relevant portions of my css, with text formatting and other nonsense removed. #container is the overall page container, #blue_box is the main content box, #left and #right are the columns in the blue box, #divider is the white line that separates them, #links is the light blue nav hovering below #blue_box.
#background {
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -9999;
}
html, body {
margin: 0;
padding: 0;
height: 100%;
}
body {
background: no-repeat #222933;
overflow: hidden;
}
#container {
position: relative;
left: 34%;
top: 10%;
width: 50%;
min-width: 450px;
max-width: 700px;
overflow: auto;
padding: 0;
}
#blue_box {
position: relative; /* so that divider has appropriate height */
width: 94%;
padding: 3%;
overflow: auto; /*needed so that div stretches with child divs*/
}
#left {
position: relative;
float: left;
width: 44%;
margin: 0;
padding: 0;
}
#right {
position: relative;
float: right;
width: 49%;
margin: 0;
padding: 0;
}
#divider{
position:absolute;
left:49%;
top:6%;
bottom:6%;
border-left:1px solid white;
}
#links {
float: right;
width: 16em;
overflow: auto;
}
Change your position from relative to absolute for the container CSS.
Your problem is your image is just there with the container coming after it with a relative positioning.
IE7 is centering your container because you've set your body to text-align:center, then you're setting your container left:34%. IE is just adding those together for some reason. This is probably why your stuff is being centered in IE. You could do a conditional stylesheet for IE7 and remove the text-align.
Can't test at the moment if this will solve the issue but using margins on the blue box to position it instead of position: relative usually makes things a lot easier in the dark world of ancient Internet Explorers.

IE6 li tags not aligning

I am a bit pressed for time so I am sorry that this is brief.
I am trying to align these six li tags that act as drop downs, IE7, IE8 and all the good browsers work fine but IE6 continues to be stubborn and put them all over the place, you can find the page here.
I am using this CSS to place them inline.
/* I beleive this is the important bit? FROM HERE */
li.rathdown {
position: relative;
float: left;
margin: 0;
padding: 0;
display: block;
}
/* TO HERE */
li.rathdown * {
margin: 0;
padding: 0;
float: left;
}
li.rathdown ul {
width: inherit;
display: none;
position: absolute;
z-index: 100;
}
li.rathdown-sub {
position: relative;
}
li.rathdown-sub ul {
z-index: 99;
}
li.rathdown img.arrow {
float: right;
margin-right: 3px;
padding: 3px;
}
I also have another problem, in IE7 and IE8 the bottom of the page curls up slightly, any ideas?
Thanks for any suggestions you can give.
I have fixed them both now. The gap at the bottom was due to the height of the page, I think it was being shortend in IE by somethings padding (???) and the menu was fixed by applying the styles to all of the li's.
Sorry for the bad answer. It's a bit of an edge case really.

Resources