Div placement off in IE8 - css

I know this fiddle isn't that great as It looks a little messy because I haven't included all of my code but you can get the general idea:
Fiddle
It works fine in FF and Chrome, but in IE8 the main chunk of text and the 3 divs underneath get all messed up and over-lap the menu on the left.
Is it something to do with position:relative that I need to include somewhere?
Something that I need to include to stop the divs over lapping?
Is there anyone that can check the fiddle in higher IE as I only have 8

I've managed to clean up the HTML and CSS a little but there are more changes you should consider making before moving forwards. I would definitely look at removing the duplication in the CSS, there are many duplicate properties which can be combined into a single property for multiple selectors. You should also make sure you are writing valid HTML, since this can also cause rendering problems across browsers.
See demo or example code below.
HTML
<div class="allinfo">
<div class="menu">
<div class="menutop">WATCHGUARD SHOP MENU</div>
<ul class="menuoptions">
<li><span class="redtext">WatchGuard Home</span>
</li>
<li>XTM Series Firewalls</li>
<li>XCS Series Firewalls</li>
<li>SSL VPN Encryption</li>
<li>Security In Education</li>
<li>Wireless Access Points</li>
<li>FREE Quotation</li>
</ul>
<div class="tradein">TRADE IN</div>
<div class="tradeininfo">
<strong>Trade Up</strong>
<p>Trade in an earlier generation WatchGuard appliance or any approved non-WatchGuard appliance-based security solution, and trade up to eligible new WatchGuard solutions at 25% off the standard purchase price.</p>
</div>
<div class="whitepapers">WHITEPAPERS</div>
<div class="whitepapersinfo">
<ul>
<li>Take Back Control</li>
<li>Data Loss Prevention</li>
<li>Securing the Virtual World</li>
</ul>
</div>
</div>
<div class="maintext">
<h5>Welcome To The WatchGuard Homepage</h5>
<br/>
<p>WatchGuard builds affordable, all-in-one network and content security solutions to provide defense in depth for corporate content, networks and the businesses they power.</p>
<p>WatchGuard's award-winning extensible threat management (XTM) network security solutions combine firewall, VPN and security services to protect networks from spam, viruses, malware and intrusions.</p>
<p>The new Extensible Content Security (XCS) appliances offer content security across e-mail and web combined with data loss prevention for complete content protection.</p>
<p>WatchGuard extensible solutions scale to offer right-sized security for small businesses up to enterprises with 10,000+ employees.</p>
<p>Since our founding in 1996, more than 600,000 WatchGuard signature red security appliances have been deployed worldwide. Today more than 15,000 dedicated partners back our products in 120 countries.</p>
<div class="products">
<div class="product"> <span>WatchGuard SSL/VPN</span>
<br/>
<br/>
<br/>
<img src="images/watchguard-tb-ssl.jpg" width="199" />
<br/>
<br/>
<p>Remote connectivity. Secure remote access that just works.</p>
</div>
<div class="product"> <span>WatchGuard XCS</span>
<br/>
<br/>
<br/>
<img src="images/watchguard-tb-xcs.jpg" width="117" height="72" />
<br/>
<br/>
<p>Content security. Defense in-depth email security and web security.</p>
</div>
<div class="product"> <span>WatchGuard XTM</span>
<br/>
<br/>
<br/>
<img src="images/watchguard-tb-xtm.jpg" width="122" height="72" />
<br/>
<br/>
<p>Multi-function firewalls. Incredible speed. Unbelievable value.</p>
</div>
</div>
</div>
</div>
CSS
.redtext {
color:#DF0005;
}
.banner {
position:relative;
top:10px;
}
.menu, .maintext {
display:table-cell;
padding:10px;
}
.maintext {
height:500px;
font-size:smaller;
font-weight:normal;
vertical-align:top;
margin-left:240px;
}
.maintext h5 {
font-weight:lighter;
}
.menu {
position:relative;
width:235px;
}
.menutop {
height:30px;
background-color:rgb(221, 221, 221);
color:#666;
line-height:30px;
font-weight:bold;
border-style:solid;
border-width:1px;
border-color:#CCC;
text-indent:10px;
font-size:smaller;
}
.menuoptions {
color:#666;
line-height:30px;
font-weight:bold;
list-style:none;
padding: 0;
font-size:smaller;
}
.menuoptions li {
border-bottom:solid 1px #ccc;
padding-left:10px;
}
.tradein {
background-color:rgb(221, 221, 221);
color:#666;
line-height:30px;
font-weight:bold;
border-style:solid;
border-width:1px;
border-color:#CCC;
text-indent:10px;
font-size:smaller;
}
.tradeininfo {
color:#333;
border-style:solid;
border-width:1px;
border-color:#CCC;
padding:10px;
font-size:smaller;
}
.whitepapers {
background-color:rgb(221, 221, 221);
color:#666;
line-height:30px;
font-weight:bold;
border-style:solid;
border-width:1px;
border-color:#CCC;
text-indent:10px;
font-size:smaller;
}
.whitepapersinfo {
color:#666;
border-style:solid;
border-width:1px;
border-color:#CCC;
line-height:30px;
font-weight:bold;
font-size:smaller;
}
.whitepapersinfo li:not(:last-child) {
border-bottom:solid 1px #ccc;
}
.product {
position:relative;
width:205px;
height:205px;
border-style:solid;
border-width:1px;
border-color:#CCC;
margin:5px;
padding:10px;
text-align:center;
display:inline-block;
vertical-align:top;
}
.product span {
position:relative;
font-size:18px;
margin:0 auto;
color:#333333;
}
.product p {
text-align:left;
font-size:smaller;
color:#333333;
}

Related

CSS element doesn't show up in Chrome, but does on Firefox

I'm very new to all of this CSS business, so please forgive me if I'm missing something obvious. I'm using the 960.gz grid system to create a site at www.locodingo.com
I'm having an issue getting a light grey box (adBox in my CSS code) to show up on the right side of my website in Chrome underneath my menu, but it loads just fine in Firefox and Internet Explorer. I've messed with what seems like pretty much every variable but just can't get it to show. Please help!
* {
font-family:Arial, Verdana, sans-serif;
color:black;
}
#header {
background-color:#d3d3d3;
height:90px;
border-radius:10px;
position:absolute;
}
#header #logo {
height:80px;
padding:5px;
}
#nav li {
color:#F58535;
background-color:white;
float:right;
position:relative;
top:-99px;
right:0px;
text-align:left;
display:inline;
padding:7px;
font-weight:bold;
margin-right:15px;
border-radius:5px;
}
#nav2 li {
color:#6ABD50;
background-color:white;
position:relative;
display:inline-block;
float:right;
top:32px;
padding:7px;
font-weight:bold;
margin-right:15px;
border-radius:5px;
right:10px;
}
#nav li:hover {
background-color:#F58535;
color:white;
}
#nav2 li:hover {
background-color:#6ABD50;
color:white;
}
#adsBox {
height:250px;
background-color:#F2F3F3;
margin-top: 50px;
clear:right;
border-radius:10px;
display:inline-block;
}
#adsBox p {
margin:5px;
text-align:justify;
}
#footer {
position:relative;
background-color:black;
color:#F58535;
font-weight:bold;
font-family:sans-serif;
font-size:12px;
text-align:center;
height:20px;
clear:both;
}
bodyText{
right:122px;
position:relative;
float:left;
color:red;
display:block;
}
<div class="container_12 clearfix">
<div id="header" class="grid_12">
<img id="logo" src="images/logo.png"/>
<div id="nav">
<ul>
<li>Contact Us</li>
<li>Message Board</li>
<li>Opinion</li>
<li>Articles</li>
</ul>
</div>
</div>
</div>
<div id="nav2">
<ul>
<span><li>Cosplay</li></span>
<span><li>Tattoos</li></span>
<span><li>Music/Art</li></span>
<span><li>Recipes</li></span>
</ul>
</div>
<div class="container_12 clearfix">
<div id="bodyText" class="grid_8"><p>Just safdsfdadfafdfdome random stuff here.ust safdsfdadfafdfdome random stufust safdsfdadfafdfdome random stufust safdsfdadfafdfdome random stufust safdsfdadfafdfdome random stufust safdsfdadfafdfdome random stufust safdsfdadfafdfdome random stuf adggdadgsagddgsdsgagsd</p></div>
<div id="adsBox" class="grid_4"><p>Test text here est text hereTest text here est text hereTest text here est text hereTest text here est text hereTest text here est text hereTest text here est text hereTest text here est text hereTest text here est text here</p>
</div>
</div>
Do you have AdBlockPlus or any kind of adblocker extension in Chrome? If so, it's probably hiding that block based on its id.
jack was able to answer my issue for me. It was indeed AdBlockPlus blocking the div container because it was called "adsBox" and contained the word "ads". I feel pretty stupid - I guessthis is just one of those stupid little things I've got to learn about on my journey.
So, for future reference - don't name any container with the word "ads" in it.
Thank all of you for helping me out. Each and every one of you had valuable information that I'll be able to use.

css footer background didn't shows properly in html5

Here is my css code:
.footer{
clear:both;
background:url('../img/footer-bg.jpg');
overflow: hidden;
}
.footer-left{
float:left;
width: 50%;
}
.footer-right{
float:right;
width:50%;
}
.footer-nav .list-1 {
font-size:13px;
font-weight:600;
text-align: center;
}
.footer-nav .list-2 {
font-size:12px;
font-weight:600;
text-align: center;
}
.footer-nav ul li{
display:inline;
padding:8px;
}
.copyright{
font-size:13px;
text-align: center;
}
Here is my JSfiddle link: http://jsfiddle.net/3jet0dfu/12/
May i know how to set background image to 100% attached with window screen.and the footer content need to display right of image.
Now i added <hr /> line for footer-left and footer-right at the top and bottom.
But it shows at the top only, Can anybody help me exact css style to fix this.
I need look like this http://s30.postimg.org/gvqtdrmqp/article_page4.jpg.
Thanks in advance.
add to css
header,section{
margin:0 auto;
width:939px;}
and edit body css like this
body{
font-family: Raleway, sans-serif;
}
this working page jsfiddle
remove the 2 and replace the following html and add the css
<div id="footer-holder">
<div class="footer-left">
<img src="http://s18.postimg.org/itr24b7s9/footer1.png" alt="footer-image" />
<div class="footer-content">
<p class="footer-title">.NET Training</p>
<p class="footer-pgf">Less of boring theory! Hands on programming is our training methodology! You'll love it.<p>
learn more
</div>
</div>
<div class="footer-right">
<img src="http://s18.postimg.org/gl8a98bah/footer2.png" alt="footer-image" />
<div class="footer-content">
<p class="footer-title">Shopify Expert at $20/hour</p>
<p class="footer-pgf">Unique custom made shopify theme and tweakss. Strat selling online with stunning eCommerce storefronts created using the Shopify CMS</p>
learn more
</div>
</div>
<div style="clear:both"></div>
</div>
#footer-holder{
-webkit-border-image:url(border.png) 30 30 round; /* Safari 3.1-5 */
-o-border-image:url(border.png) 30 30 round; /* Opera 11-12.1 */
border-image:url(border.png) 30 30 round;
border-left:none;
border-right:none;
width: 100%;
}

Having trouble with 0 height div, but no floats. What can I do?

http://www.walkerspencer.com/chrhsweb/max
So I'm currently working on a high school project, and I'm completely stumped. One of my divs, article, isn't behaving how I'd like it to. It has a height of 0. Now, after a lot of googling and research, it seemed like this was a common issue... for containers which contained floating elements. My article contains no floating divs. I even tried removing float from the css for my #buttons div, and it had no effect. I've also tried most of the suggested float fixes: the clearfix method, clear:both. At this point, I just need an outside opinion. I couldn't find any major errors in my code (besides a general disorganization and misuse of semantic elements). The intended behavior is that sections scale while maintaining a 16:9 ratio as the browser resizes, and have a black transparent background that fills the entire article. I could also apply the background to article, but article doesn't have a height either. If you'd just like to critique my bad code habits and formatting, that's alright too :). The images' absences shouldn't be important, though they are in a 16:9 ratio, and I had this problem before adding any jquery. Thank you so much. Sorry if there's an issue with my post or how I've asked it, it's my first time asking a question on here.
HTML:
<head>
<meta charset='utf-8'/>
<title>design</title>
<link rel="stylesheet" type="text/css" href="reset.css"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link href='http://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#images").cycle({
containerResize: false,
slideResize: false,
fit: 1
});
$('article').cycle({
activePagerClass: 'activeSlide',
containerResize: false,
slideResize: false,
fit: 1,
timeout: 0,
speed: 300,
startingSlide:0,
pager: "#buttons",
pagerAnchorBuilder: function(idx, slide) {
return '#buttons li:eq(' + idx + ')';}
});
$('#right').click(function() {
$('article').cycle("next");
return false;
});
$('#left').click(function() {
$('article').cycle("prev");
return false;
});
});
</script>
</head>
<body>
<div id="container">
<div id="arrows">
<div id="left"><</div><div id="right">></div>
</div>
<nav>
<ul id="buttons">
<li>
<li>
<li>
<li>
<li>
</ul>
</nav>
<div class="fix"></div>
<article>
<section id="images">
<img src="images/alaska.jpg" width="100%" height="auto"/>
<img src="images/field.jpg" width="100%" height="auto"/>
<img src="images/sunset.jpg" width="100%" height="auto"/>
</section >
<section id="about">
<p>
my name is <span style="color:crimson">max</span>.<br>
i'm a senior in high school.<br>
i love <span style="color:yellow">code</span><br>
<span style="color:#a45bc4">&</span><br>
i love <span style="color:lightgreen">design</span>.<br>
<span style="color:#a45bc4">welcome to my site.</span>
</p>
</section >
<section id="work">
</section >
<section id="contact">
</section>
<section id="place">
</section>
</article>
<div id="bottom"></div>
</div>
</body>
CSS:
body{
background-image:url("images/clouds.jpg");
background-size:cover;
background-color:white;
background-repeat:no-repeat;
height:100%
}
#container{
width:70%;
min-height:103px;
margin:0 auto;
min-width:182px;
}
#arrows{
max-width: 140px;
height: 70px;
background: #f7f7f7;
-moz-border-radius: 70px 70px 0 0;
-webkit-border-radius: 70px 70px 0 0;
border-radius: 70px 70px 0 0;
margin:auto;
position:relative;
top:25px;
z-index:100;
border-top:1px solid;
border-color:#cccccc;
font-family:"Lato";
text-align:center;
vertical-align:middle;
line-height:60px;
font-size:68px;
color:#cfcfcf;
font-weight:100;
font-stretch:ultra-condensed;
}
#right:hover, #left:hover{
color:#a45bc4;
text-decoration:none;
}
#right, #left{
display:inline;
color:#cfcfcf;
text-decoration:none;
cursor:pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
nav{
width:calc(100%-2px);
border-left:1px solid #cfcfcf;
border-right:1px solid #cfcfcf;
height:35px;
background-color:#f7f7f7;
min-width:182px;
}
#buttons{
position:relative;
float:right;
margin-right:6px;
z-index:100;
}
.fix{
clear:both;
}
.current{
padding-right:0px;
}
#buttons li{
display:inline-block;
height:26px;
width:26px;
background-image:url("images/navc.jpg");
background-repeat:no-repeat;
background-position:center;
background-size:24px;
margin-left:8px;
margin-top:4px;
vertical-align:middle;
cursor:pointer;
}
#buttons li:hover{
opacity:.8;
}
#buttons a{
color:black;
text-decoration:none;
}
#buttons li.activeSlide{
background-image:url("images/violetc.jpg");
height:26px;
width:26px;
background-size:26px;
vertical-align:middle;
}
article{
width:100%;
min-width:184px;
height:100%;
}
section{
height:100%;
width:100%;
margin:0 auto;
text-align:center;
vertical-align:middle;
color:white;
font-weight:100;
font-size:36px;
font-family:"Lato";
background-color:rgba(0,0,0,.4);
}
p{
}
#about{
}
.option img{
opacity:.6
}
.option:hover{
opacity:.8;
}
#bottom{
border-left:1px solid #cfcfcf;
border-right:1px solid #cfcfcf;
border-bottom:1px solid #cfcfcf;
height:30px;
background-color:#f7f7f7;
min-width:182px;
margin-top:56.25%;
}
#media all and (max-width:690px){
#buttons{
margin-top:2px;
width:98%;
text-align:center;
}
nav{position:relative;
text-align:center;}
}
If you're keeping the slideshow plugin, and it is what's causing the absolutely positioned children (you're not doing it,) then your only option is to force the height of the article element, if you want to use it for something.
You can either apply a class/ID to it (if you're using other article elements that have nothing to do with this style, and you only use it once per page, then use an ID, or if you want to re-use it somewhere else on the same page, use a class.) So you would have something like:
article.slideshow-container { height: 498px; }
And you can then use it for whatever you want. This is a fixed-height though, so if image height changes, you lose out again.
The problem is definitely with your implementation of the jQuery Cycle Plugin. As setek has mentioned, the slideshow makes your section divs position absolute, which collapses the height of the article element to 0. You can add the following to your cycle script to dynamically adjust the height for each slide/section:
before : function(currSlideElement, nextSlideElement){
$('article').css('height', $(nextSlideElement).height()+'px');
},
You should also clean up your code (it is a bit of a mess) and try to take things step by step. I have created a working example for you here:
http://jsfiddle.net/BCyD8/
You will have to work a bit to get the spacing right.

Difficulty creating a content grid layout using css and html

I am trying to create a grid layout using tags and css. I need the grid system to hold four main blocks as portrayed in the image below. I have created a solution that works great in safari and chrome, but not so well in firefox as the titles overlap. Please see my code below, and maybe someone can see where I have gone wrong! I cant for the life of me find the problem.
HTML CODE:-
<div class="elements_wrapper">
<div id="element1">
<img class="align-image" src="img/image1"/>
<span class="element-title">Title</span>
<p class="element-explain">Main text goes here</p>
</div>
<div id="element2">
<img class="align-image" src="img/image2"/>
<span class="element-title">Title</span>
<p class="element-explain">Main text goes here</p>
</div>
<div id="element3">
<img class="align-image" src="img/image3"/>
<span class="element-title">Title</span>
<p class="element-explain">Main text goes here</p>
</div>
<div id="element4">
<img class="align-image" src="img/image4"/>
<span class="element-title">Title</span>
<p class="element-explain">Main text goes here</p>
</div>
</div>
CSS CODE:-
.elements_wrapper {
width:100%;
margin-left:-65px;
margin-top:110px;
padding-bottom:30px;
}
#element1{
position:absolute;
display:inline-block;
margin-left:30px;
padding-bottom:20px;
}
#element2 {
position:absolute;
display:inline-block;
margin-top:200px;
margin-left:30px;
padding-bottom:20px;
}
#element3 {
position:absolute;
display:inline-block;
margin-left:545px;
margin-top:200px;
padding-bottom:20px;
}
#element4 {
position:absolute;
display:inline-block;
margin-left:545px;
padding-bottom:20px;
}
.element-title {
font-family:helvetica, arial, serif;
color:black;
display:inline;
font-size:14pt;
font-weight:bold;
padding-top:15px;
}
.element-explain {
font-family:helvetica, arial, serif;
font-size:10pt;
float:left;
width:280px;
}
.align-image {
border: none;
float:left;
padding-right:15px;
}
My code works great in safari and chrome, but not that well in firefox, please help. Also, please let me know if the code I have already used is bad or needs changing to ensure cross browser compatibility. Thanks so much.
See the next example: http://jsfiddle.net/ZNSAX/2/
.element-explain {
font-family:helvetica, arial, serif;
font-size:10pt;
float:left;
width:280px;
}
Floating left here will cause this error. Firefox is a bit finicky with floating elements than Chrome and IE. Removing this should fix your problem.

Div not expanding with content

I know there are several posts about this but none of the solutions are working for me. With that said, my containing div will not grow with my content. I know why this is happening, because it is 'float'ing but even when I use 'clear' it will not expand with the parent div. I've tried using using clear in nearly every element below with no success. Any help would be greatly appreciated.
View Image of problem:
For a live example please visit, http://thehopcompany.com/index.php?id=49
---------------CSS----------------
.product {
width:775px;
margin:0;
padding:0;
margin-top:75px;
margin-left:-8px;
}
.product ol{
margin:0px;
}
.product li{
list-style:none;
margin: 0 0 15px 0;
padding:15px;
border:1px solid #ccc;
height:100px;
color:#000;
}
.product-column-left{
float:left;
width:100px;
height:100px;
}
.product-column-right{
float:left;
width:120px;
border-left:1px solid #ccc;
height:100px;
text-align:center;
}
.product-column-center{
float:left;
width:470px;
min-height:100px;
padding-right:15px;
padding-left:15px;
text-align:left;
padding-bottom:30px;
display:block;
}
.product h2{
font-size:18px;
margin-bottom:5px;
margin-top:0;
}
.product .text-underline{
text-decoration:underline;
}
.description-text{
font-size:12px;
color: #000;
}
.clear{
clear:both;
}
--------------------------HTML--------------------------
<li style="list-style:none;">
<div style="width:750px;" >
<div class="product-column-left">
<img align="left" style="border:0;" src="images/hop-pellets.png" width="100" height="100" />
</div>
<div class="product-column-center" >
<h2><span class="hop-title-text-product">Columbus, Tomahawk and Zeus</span></h2>
<div class="description-text" >Proprietary naming rights sometimes have identical or nearly identical strains being sold under multiple names. Columbus, Tomahawk and Zeus, or the CTZ hops, are the most famous example of this phenomenon. CTZ hops are known as super-alpha hops due to the extremely high percentage of alpha acids they contain, making them ideal bittering additions. Columbus hops can be found alongside Centennial hops in Stone Ruination IPA or in Saranac's Brown Ale.
Proprietary naming rights sometimes have identical or nearly identical strains being sold under multiple names. Columbus, Tomahawk and Zeus, or the CTZ hops, are the most famous example of this phenomenon. CTZ hops are known as super-alpha hops due to the extremely high percentage of alpha acids they contain, making them ideal bittering additions. Columbus hops can be found alongside Centennial hops in Stone Ruination IPA or in Saranac's Brown Ale.
</div>
<div class="product-column-right">
<h2>$0.00</h2>
<img style="margin-top:10px; border:0;" type="image"src="images/add-to-cart-button.png" width="90" height="25" />
</div>
</div>
</li>
</ol>
</div>
Try to add overflow hidden to the parent li
.product li {
....
overflow: hidden;
/*height: 100px;*/
}
The problem with overflow:hidden is it will hide overflowing elements if you have them in your layout. So by using clearfix which is i suppose the best practice you can acheive it like below.
.clearfix:after {
content: " "; /* Older browser do not support empty content */
visibility: hidden;
display: block;
height: 0;
clear: both;
}
Then, basically you just need to add the class in your container elements. More about Clearfix
<li class="clearfix">
<div style="float: left;">
<div class="content">Big content</div>
</div>
</li>
FIDDLE DEMO
Adding a clearfix should solve your problem:
.clear{width: 100%; clear: both; height: 0px; line-height:0px;}
<div class='clear'></div>
.clear{width: 100%; clear: both; height: 0px; line-height:0px;}
<div class='clear'></div>
Add the above div at the very end of your container div (i think after product-column-right) and just before your closing li tag. That should ensure that the div spans the content.
Your product.li style has a height of 100px, so that's going to constrain the box no matter what. Remove that setting (or change it to height:auto) and then add an empty clear div just before the closing li tag and you should be fine.
So your CSS definition would change to:
.product li{
list-style:none;
margin: 0 0 15px 0;
padding:15px;
border:1px solid #ccc;
height:auto;
color:#000;
}
And then the relevant HTML:
<img style="margin-top:10px; border:0;" type="image"src="images/add-to-cart-button.png" width="90" height="25" />
</div>
</div>
<div style="clear:both"></div>
</li>
</ol>
</div>
I was using overflow: for a while with much success - but I had a few problems and decided to go back to this clear fix. If you have any problems - check it out.
http://css-tricks.com/snippets/css/clear-fix/

Resources