content with absolute position not showing in all browsers - css

i'm building one site with wordpress+gantry framework, with responsive layout selected, and i have in the left side of the screen one picture above background. this left picture ( some kind of vertical sidebar withouth other content) is positioned absolutely with next code:
div.imgleft{
content: url('http://coszminart.ro/wp-content/uploads/2014/02/laterala.png');
position: absolute;
margin-left: 0px;
margin-top: -1px;
max-height: 1020px;
height: 100%;
max-width: 570px;
background-size: cover;
z-index: 1000 !important;
}
the div.imgleft i inserted above header, in the template index.php
THE PROBLEM: the left image is not showing in iexplore 10, 11, latest mozilla, just in chrome and android phone. If i verify with chrome/firefox inspect tools, the css code is loaded ok. I've read that absolute positioning is cross browsers compatible, why is not working, is something wrong with my code?
![enter image description here][1]
Thanks for any help, sorry for the bad English.

The content property is used with the :before and :after pseudo-elements, to insert generated content.
So use
background-image : url('http://coszminart.ro/wp-content/uploads/2014/02/laterala.png');
instead of content
Here is working fiddle http://jsfiddle.net/krunalp1993/Az5GG/1/

Related

Content cut off/Footer not staying at the bottom

I added code to my css so my background would stop stretching, when content is on the page. However now my content is being cut off, and I think its because the footer is not staying at the bottom of the page. Its visible if the page loads a little slow, but once the content loads you can't see the footer anymore. Nor can you scroll down without changing the height. I've tried plugins, and additional code suggested on other post. None have helped. Is there a way I can keep my footer at the bottom, while keeping the code that keeps my background from stretching? edit I'm sorry left out the code that used to stop the stretching. It can be seen below. Also, an example of what is happening can be seen here.
#primary
{
position: absolute;
left: 0;
height: 100%;
background-size: cover;
background-attachment: fixed;
}
This is a screenshot of the original issue.. My content (the player) can be seen completely, but the background is stretched. By adding position: absolute;I got the background to load correctly, but now the content is cut off. A screenshot of results can be seen here for my mobile device, and Here for my desktop. As you can see, the player cuts off on mobile, and both don't show the footer. At first I thought the footer was loading. After changing the value of top, I can see the footer which seems to be behind the content. I changed it to top: 370, and I got this for on my mobile, and this on my desktop.. The social icons in the footer is there, but its loading behind the content, and in the middle of the page. It appears that is why my content is being cut off.
I'm not sure I entirely understand your question... but I think the issue with your CSS is the height: 100%;. Adding 100% height makes it 100% height of the screen - and because it doesn't start at the top of the page it extends down below the bottom of the visible area. If you add the CSS top: 0; then you'll see what I mean - it no longer goes below the bottom of the screen, however it now overlaps the header. To get around this, you can change the CSS to:
position: absolute;
left: 0;
height: calc(100% - 54px); /*Minus the height of the header*/
top: 54px; /*The height of the header*/
background-size: cover;
background-attachment: fixed;
I hope this helps, if not please explain the issue in more detail and I'll see if I can help!
After a few days of troubleshooting and searching the web, I found a solution for my problem. I added code to put the footer at the bottom of the page. The code left the footer stickied, instead of at the bottom of all the content. It also didn't change the cutting off of my content. So I knew it wasn't the footer.
The way I wanted the footer to be at the bottom of the content. So a fixed footer isn't what I needed, but I found out a pushing footer would do the trick. Apparently, when the its not a lot of content on the page, sometimes the footer will push up to where the content stops. So my next step was to find out exactly what was cutting the conter off.
It the container that was cutting off in the middle of the layout. #primary in the code the make background stop stretching was the wrong selector, so I changed it to body. I also added a code to make the height and width of the container 100%. Then BOOM it worked. Below is all the additional css I used to fixed the problem. Thank you to everybody who helped me.
body {
width:100%;
height:100%;}
body {
position: absolute;
background-size: cover;
background-attachment: fixed;}

css transform is not working correctly with firefox

on my website https://koengeter-immobilien.de i have a centered logo with a shrinked header. I centered the logo with the css command
.html_header_top.html_logo_center .logo {
transform: translate(-63%, -2%); }
It works fine in Google Chome and IE. But in firefox the logo is above the menu when the the website is scrolled.
I cant find a solution for firefox.
Can somebody help?
best regards
The div menu must be positioned absolute:
#header_main_alternate {
z-index: 2;
position: absolute;
width: 100%;
}
If you inspect the code you can see the 2 divs stay one over the other.

Background image won't stick to corner on mobile

Got a question specifically about the background image on a simple site I'm building.
http://polyamsterdam.nl/
The background image in question is behaving like it should (or at least as I want it to) on my laptop. It sticks to the bottom right corner of the screen.
On mobile (tested it on iPhone so far) the image also sticks to the bottom right corner but if there's more content then fits the screen the background image is pushed to the bottom of the page (instead of just the bottom of the screen).
Haven't been able to find a solution in the archive so I hope someone is able to help.
Thanks, Peter
I only tested in browserstack but adding this fixed the problem in Chrome for Android:
body, html {
height: 100%;
}
Edit:
I misunderstood the question. The best way I can think to fix this is to apply the background to an element that has the dimensions of the screen and has position: fixed set to it. The way backgrounds work, you will always get the image pushed to the bottom. Don't forget to set the z-index correctly (to -1 for instance) to make it stick to the back of the page.
So, in your HTML:
<body>
<div id="heartbackground"></div>
<!-- the rest of your HTML... after this -->
</body>
Then in your CSS
#heartbackground {
position: fixed;
width: 100%;
height: 100%;
bottom: 0;
left: 0;
}

Website scrolling to the right on certain pages

I have created http://amitchauhan.site88.net/EPC%20Website/Website%201/ as you can see on the home page the site fits perfectly without giving excess blank space on the right but on the rest of the pages i get excess space on the right. Can some one help me sort this problem as i dont think there is a problem in the css.
reolaces the existing CSS declarations for id address2 with this.
#address2 {
position: absolute;
/* width: 100%; */
height: 29px;
z-index: 3;
left: 21%;
top: 1526px;
}
The div with the id of address2 is the problem. If you remove the width: 100% it will fix this problem
You can fix this by adding html {overflow-x:hidden;} to you CSS.
This tells the browser to crop anything out of view that is out of the 100% width on the right or left.
Another option is to add html {width:100%;} to your CSS.
This tells the browser to move all elements into the 100% visible width. It would eliminate scrolling left or right, but may disposition elements if your site is not responsive.
Hope this helped!

min-height 100% does not extend the full page in WebKit browsers

I have the following CSS:
#middle {
float: right;
width: 590px;
height: auto !important;
min-height: 100%;
height: 100%;
}
My goal is to get the #middle div to extend all the way to the bottom. This code works perfectly in FF but does not in WebKit browsers. I've figured out that this is due to the float: right property, without floating, this issue doesn't persist
In WebKit browsers, it looks like min-height is being deduced and permanently set on the #middle div. This can be viewed by loading the page with the window contracted and then expanding the window to a larger size.
Here is a demo site of the issue: http://staging.similarblue.com/about/beliefs/
I realize I could use some JS to handle this (on window resize) but I was wondering if there's a pure CSS alternative.
Here is a screenshot of the issue: http://i56.tinypic.com/s49e37.jpg
Thanks!
Two lines up in your style.css file there's a height:auto!important declaration, which is overriding your height:100% declaration. Without that line, your site looks fine!
What you may be looking for is this. It's served me well in the past, hopefully it helps you!
What you could do is make the background div:
position: fixed;
top: 0;
bottom: 0;
And then put the content in a separate div on top of the fixed background. Here's an example: Demo
EDIT: accommodated scroll.

Resources