you are in: codestackercodes [RSS] → tag: css [RSS]

css clearfix Delicious

“The problem happens when a floated element is within a container box, that element does not automatically force the container’s height adjust to the floated element. When an element is floated, its parent no longer contains it because the float is removed from the flow”

http://www.webtoolkit.info/css-clearfix.html

show/hide lines
   1  .clearfix:after {
   2      content: ".";
   3      display: block;
   4      clear: both;
   5      visibility: hidden;
   6      line-height: 0;
   7      height: 0;
   8  }
   9  
  10  .clearfix {
  11      display: inline-block;
  12  }
  13  
  14  html[xmlns] .clearfix {
  15      display: block;
  16  }
  17  
  18  * html .clearfix {
  19      height: 1%;
  20  }
created by leozera — 18 November 2008 — get a short url — tags: css embed

[css3] border-radius sample Delicious

http://www.css3.info/border-radius-apple-vs-mozilla/

show/hide lines
   1  .round-all {
   2      -webkit-border-radius: 5px;
   3      -moz-border-radius: 5px;
   4      border-radius: 5px;
   5  }
   6  .round-top {
   7      -webkit-border-top-right-radius:5px;
   8      -webkit-border-top-left-radius: 5px;
   9      -moz-border-radius: 5px 5px 0 0;
  10       border-radius: 5px 5px 0 0;
  11  }
  12  .round-right {
  13      -webkit-border-top-right-radius: 5px;
  14      -webkit-border-bottom-right-radius: 5px;
  15      -moz-border-radius:0 5px 5px 0;
  16       border-radius:0 5px 5px 0;
  17  }
  18  .round-bottom {
  19      -webkit-border-bottom-right-radius: 5px;
  20      -webkit-border-bottom-left-radius: 5px;
  21      -moz-border-radius:0 0 5px 5px;
  22       border-radius: 0 0 5px 5px;
  23  }
  24  .round-left {
  25      -webkit-border-top-left-radius: 5px;
  26      -webkit-border-bottom-left-radius: 5px;
  27      -moz-border-radius: 5px 0 0 5px;
  28       border-radius: 5px 0 0 5px;
  29  }
created by leozera — 08 November 2008 — get a short url — tags: css embed

remove the mac os x glowing blue outline for input fields Delicious

show/hide lines
   1  input:focus { outline: none; }
created by leozera — 18 October 2008 — get a short url — tags: css input mac safari embed

short css Delicious

show/hide lines
   1  div { margin: 10px 20px 30px 40px } /* top, right, bottom, left */
   2  
   3  div { margin: 10px 20px 30px } /* top, left and right, bottom */
   4  
   5  div { margin: 10px 20px } /* top and bottom, left and right */
   6  
   7  div { margin: 10px } /* all four sides */
created by leozera — 12 October 2008 — get a short url — tags: css tip embed

ie conditional hack Delicious

show/hide lines
   1  <!--[if IE]>
   2  	<link rel="stylesheet" type="text/css" href="ie-only.css" />
   3  <![endif]-->
   4  
   5  # Embedded CSS
   6  <!--[if IE]>
   7    <style type="text/css">
   8      #container {font-family: arial,verdana,sans-serif,tahoma;}
   9    </style>
  10  <![endif]-->
  11  
  12  # The opposite technique, targeting only NON-IE browsers:
  13  <!--[if IE]>
  14  	<link rel="stylesheet" type="text/css" href="ie-only.css" />
  15  <![endif]-->
  16  
  17  # Target specific versions of IE
  18  # IE 7 ONLY:
  19  <!--[if IE 7]>
  20  	<link href="IE-7-SPECIFIC.css" rel="stylesheet" type="text/css">
  21  <![endif]-->
  22  
  23  # IE 6 ONLY:
  24  <!--[if IE 6]>
  25  	<link rel="stylesheet" type="text/css" href="IE-6-SPECIFIC.css" />
  26  <![endif]-->
  27  
  28  # IE 5 ONLY:
  29  <!--[if IE 5]>
  30  	<link rel="stylesheet" type="text/css" href="IE-5-SPECIFIC.css" />
  31  <![endif]-->
  32  
  33  # IE 5.5 ONLY:
  34  <!--[if IE 5.5000]>
  35  <link rel="stylesheet" type="text/css" href="IE-55-SPECIFIC.css" />
  36  <![endif]-->
  37  
  38  # VERSION OF IE VERSION 6 OR LOWER: (I find this one pretty handy)
  39  <!--[if lt IE 7]>
  40  	<link rel="stylesheet" type="text/css" href="IE-6-OR-LOWER-SPECIFIC.css" />
  41  <![endif]-->
created by leozera — 17 September 2008 — get a short url — tags: css hack ie embed

another css reset Delicious

source: http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/

show/hide lines
   1  html, body, div, span, applet, object, iframe,
   2  h1, h2, h3, h4, h5, h6, p, blockquote, pre,
   3  a, abbr, acronym, address, big, cite, code,
   4  del, dfn, em, font, img, ins, kbd, q, s, samp,
   5  small, strike, strong, sub, sup, tt, var,
   6  dl, dt, dd, ol, ul, li,
   7  fieldset, form, label, legend,
   8  table, caption, tbody, tfoot, thead, tr, th, td {
   9  	margin: 0;
  10  	padding: 0;
  11  	border: 0;
  12  	outline: 0;
  13  	font-weight: inherit;
  14  	font-style: inherit;
  15  	font-size: 100%;
  16  	font-family: inherit;
  17  	vertical-align: baseline;
  18  }
  19  /* remember to define focus styles! */
  20  :focus {
  21  	outline: 0;
  22  }
  23  body {
  24  	line-height: 1;
  25  	color: black;
  26  	background: white;
  27  }
  28  ol, ul {
  29  	list-style: none;
  30  }
  31  /* tables still need 'cellspacing="0"' in the markup */
  32  table {
  33  	border-collapse: separate;
  34  	border-spacing: 0;
  35  }
  36  caption, th, td {
  37  	text-align: left;
  38  	font-weight: normal;
  39  }
  40  blockquote:before, blockquote:after,
  41  q:before, q:after {
  42  	content: "";
  43  }
  44  blockquote, q {
  45  	quotes: "" "";
  46  }
created by leozera — 25 August 2008 — get a short url — tags: css reset embed

another ie 6 hack Delicious

show/hide lines
   1  p {			
   2  	background: green !important; /* Major browsers other than IE 6 and below respect the importance immediately */
   3  	background: red; /* IE 6 and below use this value instead, even though the above was marked as important */
   4  }
created by leozera — 23 July 2008 — get a short url — tags: css hack ie ie6 embed

1kb ie 6 png fix hack Delicious

create a 1×1 ‘clear.gif’ image

show/hide lines
   1  var clear="images/clear.gif" //path to clear.gif
   2  
   3  pngfix=function(){var els=document.getElementsByTagName('*');var i_p=/\.png/i;var i=els.length;while (i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(i_p)&&es.filter==''){el.height = el.height;el.width = el.width;es.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src = clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(i_p)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage="none";}}if (el.currentStyle.position!='absolute' && !es.filter && !el.tagName.match(/(body|html|script)/gi)) es.position="relative";if (es.filter&&el.currentStyle.position=="relative") es.position="static";}}
   4  window.attachEvent('onload',pngfix);
created by leozera — 17 July 2008 — get a short url — tags: browser css hack ie6 js embed

another min-height hack Delicious

http://www.dustindiaz.com/min-height-fast-hack/

show/hide lines
   1  selector {
   2    min-height:500px;
   3    height:auto !important;
   4    height:500px;
   5  }
created by leozera — 17 July 2008 — get a short url — tags: css hack ie embed