Solved

Cross-Browser Compatible CSS Snippet

Posted on 2009-03-30
6
382 Views
Last Modified: 2013-11-19
The following XHTML and the attached CSS works fine in most browsers; however, in some browsers such as IE 6 it gets all out of whack. Is there anyway I can optimize this code to work in IE 6 and beyond. A working example of this code can be found here: http://www.emarketbuilders.com/portfolio/

<div class="holder" style="margin-bottom:10px ">
  <div class="pcontainer">
    <div class="pphoto"></div>
    <div class="ptext">
      <div class="arrowlink" style="float:right ">
      </div>
    </div>
  </div>
</div>
.holder{overflow:auto}
div#pcontatiner{float: left; width: 501px; margin: 10px 0px 0px 0px}
div.pphoto{float: left; width: 150px; margin:10px 5px 10px 10px}
div.ptext{float: left; width: 331px; margin: 10px 0px 10px 0px}

Open in new window

0
Comment
Question by:EMB01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:blatantwaste
ID: 24022988
remove the float for ie6
<!--[if lte IE 6]>
<style type="text/css">
.holder{overflow:auto}
div#pcontatiner{width: 501px; margin: 10px 0px 0px 0px}
div.pphoto{width: 150px; margin:10px 5px 10px 10px}
div.ptext{width: 331px; margin: 10px 0px 10px 0px}
</style>
<![endif]-->

Open in new window

0
 
LVL 14

Author Comment

by:EMB01
ID: 24023012
Do I stick that right in the CSS so the end result would be as attached?
.holder{overflow:auto}
div#pcontatiner{float: left; width: 501px; margin: 10px 0px 0px 0px}
div.pphoto{float: left; width: 150px; margin:10px 5px 10px 10px}
div.ptext{float: left; width: 331px; margin: 10px 0px 10px 0px}
<!--[if lte IE 6]>
<style type="text/css">
.holder{overflow:auto}
div#pcontatiner{width: 501px; margin: 10px 0px 0px 0px}
div.pphoto{width: 150px; margin:10px 5px 10px 10px}
div.ptext{width: 331px; margin: 10px 0px 10px 0px}
</style>
<![endif]-->

Open in new window

0
 
LVL 3

Accepted Solution

by:
blatantwaste earned 500 total points
ID: 24023379
No, that would go in the head of your page between the <head> and </head> tags... so it would look like:
<html>
<head>
<title>Blah</title>
<style type="text/css">
These are your normal styles here...
</style>
 
<!--[if lte IE 6]>
<style type="text/css">
.holder{overflow:auto}
div#pcontatiner{width: 501px; margin: 10px 0px 0px 0px}
div.pphoto{width: 150px; margin:10px 5px 10px 10px}
div.ptext{width: 331px; margin: 10px 0px 10px 0px}
</style>
<![endif]-->
</head>
<body>
body stuff...
</body>
</html>

Open in new window

0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 14

Author Comment

by:EMB01
ID: 24023417
That means the browser knows to render that CSS if it's IE6 instead of the CSS that exists further down the page? Where can I read more about that type of stuff (<!--[if lte IE 6]>)?
0
 
LVL 3

Expert Comment

by:blatantwaste
ID: 24023807
that basically says if the browser is Less Than or Equal to Internet Explorer 6, then apply whatever is contained within the "if" statement...

You can read more about it here: http://msdn.microsoft.com/en-us/library/ms537512.aspx
0
 
LVL 14

Author Closing Comment

by:EMB01
ID: 31564483
Thanks for your help!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Node.js 11 82
Application.cfm not found issue 2 65
How do I wrap text in dialog window 6 35
How to really determine how many  files in hosting 2 36
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question