![]() |
|
|||||||
| Notices |
| CSS Forum Cascading Style Sheets (CSS) and XHTML Forum |
![]() |
|
|
LinkBack (1) | Thread Tools | Display Modes |
|
|||
|
Quote:
i.e if you want to add padding to a fixed width div you can simply place a div inside the one with the fixed width and add padding to that... When I started in my current job they were using multiple stylesheets for all their sites so that they could target browsers. They now just use the one stylesheet as they now realise you can build pixel perfect cross browser sites without the need to conditional statements etc.
__________________
benchmarc |
|
|||
|
Marcos (Marc?) - It's clear from your comment that you know how to make sites do what you want them to do. This solution:
Quote:
I agree with not having multiple stylesheets - hard to maintain, and extra round trips to the server to load up, but using conditional comments and dependent selectors it is very easy to target IE versions, as follows: In the HTML page: HTML Code:
<body> <!--[if lte IE 6]> <div id="isIE_version_LTE6"> <![endif]--> <!--[if IE 7]> <div id="isIE_version_7"> <![endif]--> [PAGE CONTENT GOES HERE] <!--[if lte IE 7]> </div> <![endif]--> </body> HTML Code:
.someclass {
[rules for someclass that IE renders incorrectly]
}
#isIE_version_7 .someclass {
[any additional rules required for IE7]
}
#isIE_version_LTE6 .someclass {
[any additional rules required for IE6]
}
__________________
Paul Clark, Integresis Limited | OpenSites Professional Online Sitebuilder Build Content Managed Websites with just HTML and CSS |
|
|||
|
Quote:
I think we're going to have to agree to disagree on this one. Basically both methods achieve the same results. For me, conditional comments use more code overall than the way I would do it, I can get a bit anal about keeping my code as compact as possible. I've also always seen conditional comments as a hack, whether they are or not I really couldn't comment to be honest.
__________________
benchmarc |
|
|||
|
Just found this as well which is an interesting read:
Why “Conditional Comments” Are Bad, Repeat:*Bad – Jens Meiert
__________________
benchmarc |
|
|||
|
Yes, an interesting read, with arguments on both sides in the responses.
I think my take on this is that given the choice between CSS hacks and using Conditional Comments to either link an additional stylesheet or wrap an additional div (as I do), CCs is the way to go. That's because hacks rely on bugs in the way current browsers implement CSS; it is impossible to know how future browsers will fix / vary the way they respond to those hacks, but it is certain that no other browser is ever going to implement a behaviour that responds to IE Version Specific CCs. In regard to the "don't use CCs because that's confusing presentation and content", I don't buy that. The fact is we all compromise continually on the way we structure our HTML for presentational reasons. Want two background images on a link? CSS3 will supposedly let you do it, but for now it has to be <a><span>SOME CONTENT</span></a>. What's that SPAN doing in there? It's not serving any semantic purpose, so even though it doesn't have any styling applied, it's still presentational in my book. Same applies to your solution for IE6 box model issues. Imagine you have a page with 10 DIVs that you need to apply margin, padding and border to. In your approach, you need to nest an additional DIV inside each to allow you to work around the box model 'without browser targeting'. To me, this is browser targeting: you're just making Firefox, Opera, IE7, IE8 and all future browsers read and render 10 entirely redundant semantically irrelevant divs, and making your css for all browsers more complicated, purely so you can target IE6 and say you are doing everything with one set of styles. My approach: IE6 sees one additional DIV wrapped around the whole page - not ten; other browsers just ignore the comments and see the page as-is. The HTML is lighter, and the CSS is more 'natural'. Finally, there is the issue of validation. I challenge you to do Opacity without browser-specific CSS for IE. Now, you can put both the 'standards' and the Microsoft opacity rules into your stylesheet with no browser targeting. IE will ignore the 'standards' version; Firefox etc will ignore the IE version. No problem, but the stylesheet won't validate. Personally, I'm not bothered about making my HTML/stylesheets validate so long as the only validation errors are things I have chosen to put in. (I validate my pages to make sure those are the only errors, but I'm not bothered about putting 'validated' logos on my pages.) Where a client wants opacity (for example the overlays we use to display screenshots on http://www.integresis.com/opensites-build-process.aspx - click a screenshot to see the effect), and demands valid HTML and CSS, you have a problem. The solution: additional styles in your HTML file, hidden in a conditional comment where the validator won't see them. We shouldn't have to do this kind of thing, but sometimes it's just too much trouble to convince a client they are wrong. As you say, we may have to agree to disagree.
__________________
Paul Clark, Integresis Limited | OpenSites Professional Online Sitebuilder Build Content Managed Websites with just HTML and CSS |
|
||||
|
hi,
thanks marcos for helping me out and your suggestion to put the inside_menucard_bottom div inside the the main inside_menucard_main solved my problem as i wanted but in my next page i have another similar problem of positioning my menu in an uneven manner. here is the link to my next page ie. main course: :: Mr. Chows their I have placed more then 2 blocks of menu card items in that page but the placement of those is not as per my design . so i am attaching an image for u to get idea about my layout and so u can suggest me the changes to fix my css to achieve the desired look . Basically when u will see my page and my layout the difference is when i place my menucard in this page as their r more then 2 blocks and each of them have uneven heights the vertical gap between the 2 blocks is not maintained as per design on the leftside of the page. where as in the in the right side the vertical gap is as per the margins set by my css elements. hope u understand what am i trying to say. And thanks all of u for all those good to read articles and suggestions on browsers compatibility which will help me learn new things. Thanks for helping. |
|
|||
|
The only time you NEED to use conditional statements is for PNG transparency or drop menus as "behavior: url('');" does not validate when including your .htc file. All other times there are ways around problems that use less code both in the HTML and CSS.
Agreed, we'll agree to disagree on this one as this could go on forever :)
__________________
benchmarc |
![]() |
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Spliting image? | Danyo | Graphic Design and Web Design Help | 10 | 27-03-2008 12:55 AM |
| Image masking : Image Editing Services | Graphic Design Links | Graphic Design Links | 0 | 24-03-2008 10:50 AM |
| Help with image display! | SidekickWD | Graphic Design and Web Design Help | 8 | 13-02-2008 08:38 PM |
| image | ferdy | PC Forum | 4 | 06-06-2007 11:04 AM |
| .gif image not showing up? | zammmm | Graphic Design and Web Design Help | 4 | 07-02-2007 10:46 PM |
| All times are GMT. The time now is 12:21 PM. |