Very weird bug -- on all browsers

http://mayacove.com/dev/css2/index.html

with red border it’s fine, when I take border off it gets messed up… this happens to me all the time, it’s very frustrating… sometimes only on mozilla browsers, sometimes on all browsers… turn border on to trouble-shoot something and viola – it looks fine!! take border off and it gets messed up again… don’t even know what this bug is called, or if it’s been documented anywhere… tried both strict and transitional doctype… same problem on both…

would very very much appreciate suggestions here, as I said, this happens a to me a lot (in some situations you can put border around element, but not always, certainly not in this case…)

thank you very much…

you’re welcome :slight_smile:

about resets, i have something else to point out, which will probably not be taken well by ds60. i’m sorry if that’s the case, it’s just an idea, it has no persona criticism added to it.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=iso-8859-1"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<style type="text/css">
/* null margins and padding to give good cross-browser baseline */
html,body,address,blockquote,div,
form,fieldset,caption,
h1,h2,h3,h4,h5,h6,
hr,ul,li,ol,ul,
table,tr,td,th,p,img {
	margin:0;
	padding:0;
}

img,fieldset {
	border:none;
}
</style>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	Overlay Demo
</title>

</head><body>

<div id="pageWrapper">
	
	<div id="survey" class="overlayHome">
		<div class="borderTop"></div>
		<div class="borderMiddle">
			<p>
				Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Vix impedit ceteros atomorum in. At vim decore altera diceret, te semper aliquip intellegat nam, quo ei lorem tation urbanitas. Has iisque dissentiet ea, antiopam postulant facilisis eum ea.
			</p><p>
				Quem harum liberavisse ad sit, vocent tritani vis et. Qui primis accusata laboramus ex, mei ei brute dolore mediocrem, ius ad denique rationibus adipiscing. Est novum audiam ullamcorper eu. Vix causae similique constituam te, erant mucius saperet te ius. Te ceteros ponderum deterruisset ius, sit inimicus expetendis ei.
			</p>
		<!-- .borderMiddle --></div>
		<div class="borderBottom"></div>
	<!-- #survey.overlayHome --></div>
	
	<div id="thankYou" class="overlayHome">
		<div class="borderTop"></div>
		<div class="borderMiddle">
			<p>
				Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel,
			</p>
		<!-- .borderMiddle --></div>
		<div class="borderBottom"></div>
	<!-- #survey.overlayHome --></div>
	
	<p>
		Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Vix impedit ceteros atomorum in. At vim decore altera diceret, te semper aliquip intellegat nam, quo ei lorem tation urbanitas. Has iisque dissentiet ea, antiopam postulant facilisis eum ea.
	</p><p>
		Quem harum liberavisse ad sit, vocent tritani vis et. Qui primis accusata laboramus ex, mei ei brute dolore mediocrem, ius ad denique rationibus adipiscing. Est novum audiam ullamcorper eu. Vix causae similique constituam te, erant mucius saperet te ius. Te ceteros ponderum deterruisset ius, sit inimicus expetendis ei.
	</p><p>
		Has delicata adolescens comprehensam et, ei duo accommodare theophrastus, mei ea kasd utamur accommodare. Has id quot augue ocurreret, alienum legendos eu mea, esse errem cu vix. Ex pro mundi viderer consulatu, mei in movet partiendo assueverit. Wisi graece everti eum eu. Per clita gloriatur posidonium ea, vivendo salutatus rationibus cu sed. Deleniti luptatum dissentiet in per, quo veri voluptua singulis te.
	</p><p>
		Autem partem interpretaris usu ut, pri posse quaeque gloriatur no. Nusquam commune pericula ad qui, saepe iudicabit nec et, at facer commune dissentias eam. Veniam aliquando scripserit no has, no mei inani eirmod scaevola. Nec alia tollit meliore ex, no vim insolens vituperata adversarium, noster doctus molestiae vel et. Mea indoctum dissentiet ne, sint tamquam iuvaret per no. Ei puto fugit sadipscing eos, tollit legere vocent eos te, te has veniam commune referrentur.
	</p><p>
		Cu sea illud iracundia ullamcorper, vim kasd aliquyam voluptatum at, usu et fugit fabulas alienum. Tritani verterem voluptatum sit te, eu eam audiam eruditi. Has in putent eligendi. Aperiam takimata disputationi quo ne, ex qui quis sanctus imperdiet, mei ea magna dolorum ancillae. Ex sonet corrumpit ullamcorper pro, an ipsum consequuntur eum, his eu dolorem officiis. Id vitae alienum nam, hinc affert causae eu his.
	</p><p>
		Duo suas facete tractatos et, ei ius enim nonumy. Id mea modus graeco, no numquam platonem electram pro, cum partem sanctus fabulas at. An has iudico facilis accumsan, animal utroque aliquando no nam. Reque fabellas scribentur at sea.
	</p><p>
		Nam quidam regione vivendum id, has eu mazim affert fabellas. Inermis invenire liberavisse duo ne, id sea noster dolores. Eam te justo perpetua. Vis assum ullamcorper voluptatibus in. Fuisset oporteat eloquentiam ei per, nec natum singulis democritum id. Et eos stet ancillae intellegebat, mei et atqui mnesarchum efficiantur.
	</p>
	
<!-- #pageWrapper --></div>

</body></html>

resetting is not always needed, and as such i don’t see it’s place in a css file, only in the style element for the pages needing it. you don’t have to load a whole css file, to waste a handshake or more, to get the reset css and some more css along with it, for use or not, just for the sake of the reset sequence. think of it like a css constant.

Your code will override the reset as long as it isn’t more specific then the rule :).

Resets should be at the very top of the CSS file, and that way even the non-specific’ness rules will override the reset. Something else was probably at play there, perhaps validation. Impossible to tell just on the small hints given :).

thank you!! that bg-specif you posted (background: url(…/images/div_top.jpg) no-repeat center bottom) did it!

and indeed having that doctype commented out at the top was causing margin:0 auto prob in IE ( oh man… I had no idea…)

as for resets, I’m not a big fan of resets, a few weeks ago I was having trouble with some stuff that was totally messed up, it turns out it was the reset (never understood why my code wasn’t overwriting the reset, which was at the very top of the page… so I just got rid of it…)

thank you very much, deathshadow60, for taking the time to write all that code and post it on your server… and for unlocking the directory… man, that’s fancy!!! :slight_smile: I guess I could do sprites for those boxes, I hadn’t thought of that… thank you very much…

and thank you very much to all… I always learn something when post a problem in this group (I look sometimes to see if I can answer other users’ questions, but you guys always beat me to it…:wink:

You mean like the styling for the elements that should be present on every page on a website? Like say… the heading, the menu, the footer? You know, a consistent persistent layout so the user isn’t confronted with a different layout and navigation on EVERY page – something that appears in most every top ten list on how NOT to build a website?

You mean the content area? The header, navigation/menu and footer should be consistent across pages, otherwise you’ve got accessibility issues and bad design.

Though I think from your post in the other thread of you and I going back and forth we’re seeing the difference in where our opinions come from. I design for the INTERNET for all browsers… You appear to be working with Intranet applications… Different targets, different methods.

Though from everything you’ve said I REALLY suspect your code of being knee deep in issues that are costing you bandwidth thanks to broken methodology.

have it your way. i really don’t mind :slight_smile:

Don’t see how you see that as taking it personally… as to being mean, I’m just being truthful… PROVE ME WRONG.

But of course, you won’t actually ever produce anything to do so.

yet again you take matters so personally you can’t help being mean to the point of being almost childish :slight_smile:

you use it, i don’t. that’s it. let me tell you somethin’: “reset is to CSS as L33t is to English” :slight_smile:

and your browser caching it will only help if that css file having the reset part is generally available for all the pages. which can be false. if you have sets of different looking pages things are different. your theory of one-two files works well for a one-two page site :slight_smile: exaggerating, of course.

from what i gather so far, you have templates and make them work no matter the project. lucky you.

the rest are moot points to me. something like that:

“ESPECIALLY if you ‘need’ css reset, there’s NO EXCUSE to ever need to do that for CSS apart from not knowing enough HTML/CSS to be writing a page in the first place.”

JUST TRYING to make me jab my eyeballs out, aren’t you?!?

Must work like trash cross-browser; that or it’s chock full of saying the same values over and over for no good reason… Mind you, that’s just a guess; but it’s an educated guess.

See, constants should be global – and usually my templates either rely on the one I use’s presence, so there’s zero reason to move it into the markup except to waste bandwidth by not caching it across pages.

BULL, it MAKES more work, results in more bloated code, and generally consumes more bandwidth than OH NOES throwing in one or two haslayout triggers, maybe ONE “* HTML” to create missing bits of CSS2 in IE6/earlier (you need it more than once you’ve probably screwed up), and the occasional other minor fixes. If the IE specific code ends up more than a quarter K, the problem isn’t with the CSS, it’s probably with the markup and techniques being used to build the page in the first place.

ESPECIALLY if you ‘need’ conditional comments just to target IE7/IE8 individually, there’s NO EXCUSE to ever need to do that for CSS apart from not knowing enough HTML/CSS to be writing a page in the first place.

I mean take the above code – are we REALLY going to add 200 bytes of a CC+LINK to make a separate CSS file just to send IE “font-size:1px;” ?!?

Or putting the reset in the markup like you did – sending 314 bytes in the markup on every page that needs the reset (which on my code is usually ALL of them) instead of sending 252 bytes ONCE in the CSS and having the browser cache handle it for every other page?!? Doesn’t make ANY sense to EVER do that.

The default margins and paddings on those elements cannot be trusted cross browser - so you either use a reset, or you end up having to say margin and padding on every element every time you use them; Screw that.

me said you use reset no matter what me think not a good idea :slight_smile:

and you are right, i should have been more specific:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=iso-8859-1"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<style media="screen,projection,tv" type="text/css">
/* null margins and padding to give good cross-browser baseline */
html,body,address,blockquote,div,
form,fieldset,caption,
h1,h2,h3,h4,h5,h6,
hr,ul,li,ol,ul,
table,tr,td,th,p,img {
	margin:0;
	padding:0;
}

img,fieldset {
	border:none;
}
</style>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	Overlay Demo
</title>

</head><body>

<div id="pageWrapper">
	
	<div id="survey" class="overlayHome">
		<div class="borderTop"></div>
		<div class="borderMiddle">
			<p>
				Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Vix impedit ceteros atomorum in. At vim decore altera diceret, te semper aliquip intellegat nam, quo ei lorem tation urbanitas. Has iisque dissentiet ea, antiopam postulant facilisis eum ea.
			</p><p>
				Quem harum liberavisse ad sit, vocent tritani vis et. Qui primis accusata laboramus ex, mei ei brute dolore mediocrem, ius ad denique rationibus adipiscing. Est novum audiam ullamcorper eu. Vix causae similique constituam te, erant mucius saperet te ius. Te ceteros ponderum deterruisset ius, sit inimicus expetendis ei.
			</p>
		<!-- .borderMiddle --></div>
		<div class="borderBottom"></div>
	<!-- #survey.overlayHome --></div>
	
	<div id="thankYou" class="overlayHome">
		<div class="borderTop"></div>
		<div class="borderMiddle">
			<p>
				Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel,
			</p>
		<!-- .borderMiddle --></div>
		<div class="borderBottom"></div>
	<!-- #survey.overlayHome --></div>
	
	<p>
		Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Vix impedit ceteros atomorum in. At vim decore altera diceret, te semper aliquip intellegat nam, quo ei lorem tation urbanitas. Has iisque dissentiet ea, antiopam postulant facilisis eum ea.
	</p><p>
		Quem harum liberavisse ad sit, vocent tritani vis et. Qui primis accusata laboramus ex, mei ei brute dolore mediocrem, ius ad denique rationibus adipiscing. Est novum audiam ullamcorper eu. Vix causae similique constituam te, erant mucius saperet te ius. Te ceteros ponderum deterruisset ius, sit inimicus expetendis ei.
	</p><p>
		Has delicata adolescens comprehensam et, ei duo accommodare theophrastus, mei ea kasd utamur accommodare. Has id quot augue ocurreret, alienum legendos eu mea, esse errem cu vix. Ex pro mundi viderer consulatu, mei in movet partiendo assueverit. Wisi graece everti eum eu. Per clita gloriatur posidonium ea, vivendo salutatus rationibus cu sed. Deleniti luptatum dissentiet in per, quo veri voluptua singulis te.
	</p><p>
		Autem partem interpretaris usu ut, pri posse quaeque gloriatur no. Nusquam commune pericula ad qui, saepe iudicabit nec et, at facer commune dissentias eam. Veniam aliquando scripserit no has, no mei inani eirmod scaevola. Nec alia tollit meliore ex, no vim insolens vituperata adversarium, noster doctus molestiae vel et. Mea indoctum dissentiet ne, sint tamquam iuvaret per no. Ei puto fugit sadipscing eos, tollit legere vocent eos te, te has veniam commune referrentur.
	</p><p>
		Cu sea illud iracundia ullamcorper, vim kasd aliquyam voluptatum at, usu et fugit fabulas alienum. Tritani verterem voluptatum sit te, eu eam audiam eruditi. Has in putent eligendi. Aperiam takimata disputationi quo ne, ex qui quis sanctus imperdiet, mei ea magna dolorum ancillae. Ex sonet corrumpit ullamcorper pro, an ipsum consequuntur eum, his eu dolorem officiis. Id vitae alienum nam, hinc affert causae eu his.
	</p><p>
		Duo suas facete tractatos et, ei ius enim nonumy. Id mea modus graeco, no numquam platonem electram pro, cum partem sanctus fabulas at. An has iudico facilis accumsan, animal utroque aliquando no nam. Reque fabellas scribentur at sea.
	</p><p>
		Nam quidam regione vivendum id, has eu mazim affert fabellas. Inermis invenire liberavisse duo ne, id sea noster dolores. Eam te justo perpetua. Vis assum ullamcorper voluptatibus in. Fuisset oporteat eloquentiam ei per, nec natum singulis democritum id. Et eos stet ancillae intellegebat, mei et atqui mnesarchum efficiantur.
	</p>
	
<!-- #pageWrapper --></div>

</body></html>

and no, i don’t use reset whenever. i don’t make a habit of using it and i don’t start my css with a reset. i’m sure that if you didn’t use it we would hear the world about how crappy reset is, no matter what version :slight_smile:

and yes, i believe reset to be a constant, a code constant, not having a place in a normal css file, along with other styling rules. i believe, if it’s a must, it should be put in a style element in the page that needs it. and because this will occur rarely, caching is not a problem. but if you use it no matter what, then yes, by all means, plant it in a css file :slight_smile:

and ie conditional comment its the best way to keep your coding straight and not turn your code into stew :slight_smile: you know, something where everything goes. i’m more of a “i don’t like my different food types to touch” like in “mixing it up means more work”.

Hmm. No reset, px metric fonts declared on body (/FAIL/ right out of the gate), everything shmooshed onto one line making it difficult to debug…

… though as mentioned the ‘problem’ is margin collapse. Solution? use padding instead of margin.

If I were to code the same thing, the CSS would be something like this:


/* null margins and padding to give good cross-browser baseline */
html,body,address,blockquote,div,
form,fieldset,caption,
h1,h2,h3,h4,h5,h6,
hr,ul,li,ol,ul,
table,tr,td,th,p,img {
	margin:0;
	padding:0;
}

img,fieldset {
	border:none;
}

body {
	padding-top:30px;
	text-align:center; /* center #wrapper IE 5.x */
	/* DYNAMIC FONTS -- USE THEM!!! */
	font:normal 85%/140% arial,helvetica,sans-serif;
	color:#666;
}

p {
	padding:0.6em 0;
}

#pageWrapper {
	position:relative;
	width:900px;
	margin:0 auto;
	text-align:left;
}

.overlayHome {
	position:absolute;
	top:0;
	width:420px;
	color:#EEE;
	opacity:0.90;
	-moz-opacity:0.90;
	filter:alpha(opacity=90);
}

#survey {
	left:0;
} 

#thankYou {
	left:450px;
}

.borderTop,
.borderBottom {
	height:8px;
	font-size:1px; /* prevent IE height bug */
	background:url(images/borders.png) 0 0 no-repeat;
} 

.borderBottom {
	background-position:-420px 0;
}

.borderMiddle {
	padding:0 20px;
	/* added bgcolor for when images are disabled! */
	background:#4C4C4C url(images/borders.png) -840px 0 repeat-y;
}

#thankYou .borderMiddle {
	border:1px solid #F00;
}

With this for markup:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=iso-8859-1"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	Overlay Demo
</title>

</head><body>

<div id="pageWrapper">
	
	<div id="survey" class="overlayHome">
		<div class="borderTop"></div>
		<div class="borderMiddle">
			<p>
				Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Vix impedit ceteros atomorum in. At vim decore altera diceret, te semper aliquip intellegat nam, quo ei lorem tation urbanitas. Has iisque dissentiet ea, antiopam postulant facilisis eum ea.
			</p><p>
				Quem harum liberavisse ad sit, vocent tritani vis et. Qui primis accusata laboramus ex, mei ei brute dolore mediocrem, ius ad denique rationibus adipiscing. Est novum audiam ullamcorper eu. Vix causae similique constituam te, erant mucius saperet te ius. Te ceteros ponderum deterruisset ius, sit inimicus expetendis ei.
			</p>
		<!-- .borderMiddle --></div>
		<div class="borderBottom"></div>
	<!-- #survey.overlayHome --></div>
	
	<div id="thankYou" class="overlayHome">
		<div class="borderTop"></div>
		<div class="borderMiddle">
			<p>
				Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel,
			</p>
		<!-- .borderMiddle --></div>
		<div class="borderBottom"></div>
	<!-- #survey.overlayHome --></div>
	
	<p>
		Lorem ipsum nam reque delicatissimi id, expetenda gubergren prodesset cum ne, sed putent forensibus complectitur ex. Ei idque adversarium theophrastus vel, ad pri vocibus volutpat, quidam indoctum conclusionemque has cu. Vix impedit ceteros atomorum in. At vim decore altera diceret, te semper aliquip intellegat nam, quo ei lorem tation urbanitas. Has iisque dissentiet ea, antiopam postulant facilisis eum ea.
	</p><p>
		Quem harum liberavisse ad sit, vocent tritani vis et. Qui primis accusata laboramus ex, mei ei brute dolore mediocrem, ius ad denique rationibus adipiscing. Est novum audiam ullamcorper eu. Vix causae similique constituam te, erant mucius saperet te ius. Te ceteros ponderum deterruisset ius, sit inimicus expetendis ei.
	</p><p>
		Has delicata adolescens comprehensam et, ei duo accommodare theophrastus, mei ea kasd utamur accommodare. Has id quot augue ocurreret, alienum legendos eu mea, esse errem cu vix. Ex pro mundi viderer consulatu, mei in movet partiendo assueverit. Wisi graece everti eum eu. Per clita gloriatur posidonium ea, vivendo salutatus rationibus cu sed. Deleniti luptatum dissentiet in per, quo veri voluptua singulis te.
	</p><p>
		Autem partem interpretaris usu ut, pri posse quaeque gloriatur no. Nusquam commune pericula ad qui, saepe iudicabit nec et, at facer commune dissentias eam. Veniam aliquando scripserit no has, no mei inani eirmod scaevola. Nec alia tollit meliore ex, no vim insolens vituperata adversarium, noster doctus molestiae vel et. Mea indoctum dissentiet ne, sint tamquam iuvaret per no. Ei puto fugit sadipscing eos, tollit legere vocent eos te, te has veniam commune referrentur.
	</p><p>
		Cu sea illud iracundia ullamcorper, vim kasd aliquyam voluptatum at, usu et fugit fabulas alienum. Tritani verterem voluptatum sit te, eu eam audiam eruditi. Has in putent eligendi. Aperiam takimata disputationi quo ne, ex qui quis sanctus imperdiet, mei ea magna dolorum ancillae. Ex sonet corrumpit ullamcorper pro, an ipsum consequuntur eum, his eu dolorem officiis. Id vitae alienum nam, hinc affert causae eu his.
	</p><p>
		Duo suas facete tractatos et, ei ius enim nonumy. Id mea modus graeco, no numquam platonem electram pro, cum partem sanctus fabulas at. An has iudico facilis accumsan, animal utroque aliquando no nam. Reque fabellas scribentur at sea.
	</p><p>
		Nam quidam regione vivendum id, has eu mazim affert fabellas. Inermis invenire liberavisse duo ne, id sea noster dolores. Eam te justo perpetua. Vis assum ullamcorper voluptatibus in. Fuisset oporteat eloquentiam ei per, nec natum singulis democritum id. Et eos stet ancillae intellegebat, mei et atqui mnesarchum efficiantur.
	</p>
	
<!-- #pageWrapper --></div>

</body></html>

I tossed a copy up live on my server here:
http://www.cutcodedown.com/for_others/maya90/template.html

with the directory unlocked for ease of access to the bits and pieces:
http://www.cutcodedown.com/for_others/maya90

You’ll notice I combined the images down to a single file and did “CSS sprites” with them:
http://www.cutcodedown.com/for_others/maya90/images/borders.png

So two less handshakes and as a optimized .png we can get rid of the jpeg artifacting and have a fifth the file size. I also used tweakpng to strip the GAMA line so IE won’t have color matching issues, and added a background color to bordermiddle so that images off the layout will still look good.

Tested working in IE 5.01, 5,5, 6, 7 & 8, Opera 10.62, FF 2 & 3.53, and the latest flavors each of Safari and Chrome.

Some tips – margins are a pain in the ass, so use them sparingly. You are usually better off with padding wherever possible. Likewise, I avoid declaring width or height the same time as padding or border becuase it just screws things up too much on legacy browsers. It’s easy enough to avoid doing

I also suggest avoiding declaring width whenever possible – where you put ‘width’ and ‘margin:auto’ on the innerDIV (which you’ll notice I took an axe to since it seemed to be a useless element) when you simply could have padded either the paragraphs, or it’s parent, the borderMiddle. Likewise rather than have two separate ID for applying the border, you’ll see I just inherit off the parent ID.

Instead of margin bottom, I set padding on both sides of the P - this way the padding ‘stacks’ between them for the 1.2 desired EM (notice I switched it to dynamic fonts so lf/120dpi users like myself won’t ***** you out about it) while at the beginning and end of .borderMiddle it gets the same spacing.

Hope this helps. I’d also consider adding inner DIV to borderTop and borderBottom to make that a sliding doors effect, though the opacity could be problematic on that. That way you could make one image and use it for every concievable width your layout might want to use that effect instead of having to make a custom image for each and every occurance.

@nononope – Well, I’m not even certain what it is you said since it appears to be total gibberish, so it’s hard to take offense on that one.

Though I personally won’t put CSS IN the markup in the first place with very VERY rare exceptions. As you said, think of CSS like a constant; it’s static - unchanging for the majority of users. As such putting it in the markup on every page is made of /FAIL/ because then it’s not CACHED.

It’s also why I think using IE conditional comments to load separate CSS for those browsers is wasteful nonsense – it’s garbage in the markup that doesn’t have to be and probably shouldn’t be.

… and I have no idea WHY you posted a copy with it in the markup, unless it was to apply it to all media types (which is a BAD idea)… but again, two CSS files per media type, ONE per media type ideal, and if I had my way I’d probably deprecate STYLE both as an attribute and as a tag if not for the one or two cases where application of style might actually be content. (like when making bar graphs or ratings stars)

resetting is not always needed, and as such i don’t see it’s place in a css file, only in the style element for the pages needing it.

Which has no *** business in the markup, and a good reset helps you on EVERY page when it comes to cross browser coding. It’s part of WHY my code with little or no extra effort generally works all the way back to versions of IE5.

As to resets, a LOT of resets are fat bloated trash giving the reset a bad name – Meyer’s “reset reloaded” being a classic example of that with over half of it being stuff I’d be setting values on anyways, and qualifying more as a framework than a reset… and frameworks when it comes to CSS are made of /FAIL/. I mean the bloody thing is almost 1k and seems to often do more harm than good!

At the same time the ‘universal reset’ of * {margin:0; padding:0} completely shtups form elements cross-browser, also giving the reset a bad name.

The one I use is in-between the two (and credit for that one goes to Dan Schulz). It’s not even a quarter of a K so it can hardly be considered wasteful, it only resets the values that are inconsistent cross-browser on the elements I’m most likely to use enough for it to SAVE bandwidth instead of costing it by the time you’ve built an entire page/site template.

It’s not so much that a reset is a bad idea, it can actually save you a lot of headaches (and even bandwidth) if done right – the problem is there are some really bad ones out there.

Hi, that’s because IE6 is in quirks mode

<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">--> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

You have a comment above hte real doctype and as a result IE6 is in quirks. Remove the commented doctype

it’s only in ie6 or quirks mode.

try

background: url(…/images/div_top.jpg) no-repeat center bottom

for div class=“top”.

actually it’s totally messed up in IE… IE isn’t even respecting margin:0 auto (elements with blue border), but apart from that, problem reported in orig post persists in IE…
http://mayacove.com/dev/css2/index.html

I have padding:10px 0; and same top and btm mgns for paragr’s inside the boxes…

thank you…

only reason I did class “middle2” is so I could add the border to that one so you could see the difference (border is only diff betw the two…)

indeed if I add padding-bottom it fixes it … since have mgn-btm for the paragraphs inside the boxes I figured I only needed padding-top, but well, the browsers wanted padding-bottom too…:wink:

thank you very much…

Here’s an example:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
div {background:red;}
p {margin:0 0 100px}
</style>
</head>
<body>
<div class="test">
    <p>test</p>
    <p>test</p>
    <p>test</p>
    <p>test</p>
    <p>test</p>
</div>
<p>hello I am 100px away from the red box</p>
</body>
</html>


now add 1px padding and the margin collapse is avoided.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
div {background:red;padding:1px 0}
p {margin:0 0 100px}
</style>
</head>
<body>
<div class="test">
    <p>test</p>
    <p>test</p>
    <p>test</p>
    <p>test</p>
    <p>test</p>
</div>
<p>hello I am next to the red box</p>
</body>
</html>


Note that IE6 and 7 will behave like the second example if the div has halsayout (even without padding).

you have diff results in diff browsers. the only bug there is the way you construct those boxes :slight_smile: div class=‘ovelayInner’ is really necessary?

and it’s you div class=“middle2” that is resizing to fit the content when the border is no more. thus how it gets messed up. this one anyway. you have a lot more of those going on, i’m afraid, and diff UAs will get diff “bugs” :slight_smile:

Hi,

It’s not a bug it’s the way that collapsing margins work and they extend outside their container unless there is something solid in the way such as a border or some padding (or other content).

Just add a 1px padding top and bottom to a parent when you don’t want its children’s margin to collapse through.