:src='http://rss.buysellads.com/img.php?z=1259963&k=3469a2a501a9e18091036aa0c89f9dcb&a=9462&c=385900714' border='0' alt='' />

Advertise here with BSA

]]> http://css-tricks.com/when-using-important-is-the-right-choice/feed/ 38 Prevent White Flash While iFrame Loadshttp://css-tricks.com/prevent-white-flash-iframe/ http://css-tricks.com/prevent-white-flash-iframe/#comments Tue, 17 May 2011 20:42:40 +0000 Chris Coyier http://css-tricks.com/?p=9448 If you Google around about this problem (at the time of this writing), you'll find some incomplete answers and some other snippets advocating this bad practice:

<!-- NO! Bad! -->
//AN_Xml:<iframe src="..." style="visibility:hidden;" onload="this.style.visibility='visible';"></iframe>

The reason this is bad is that the CSS will hide the iframe no matter what and users with JavaScript turned off will never see that iframe. Now I'm not usually one to go to extreme lengths to cater to that crowd, but I'm all for using better solutions that do solve that issue when they are available.

The solution

Thanks to Paul Irish and his Surefire DOM Element Insertion and Ryan Seddon and his article on inserting scoped style elements, we have this:

// Prevent variables from being global
//AN_Xml:(function () {
//AN_Xml:
//AN_Xml:      /*
//AN_Xml:          1. Inject CSS which makes iframe invisible
//AN_Xml:      */
//AN_Xml:
//AN_Xml:    var div = document.createElement('div'),
//AN_Xml:        ref = document.getElementsByTagName('base')[0] ||
//AN_Xml:              document.getElementsByTagName('script')[0];
//AN_Xml:
//AN_Xml:    div.innerHTML = '&shy;<style> iframe { visibility: hidden; } </style>';
//AN_Xml:
//AN_Xml:    ref.parentNode.insertBefore(div, ref);
//AN_Xml:
//AN_Xml:    /*
//AN_Xml:        2. When window loads, remove that CSS,
//AN_Xml:           making iframe visible again
//AN_Xml:    */
//AN_Xml:
//AN_Xml:    window.onload = function() {
//AN_Xml:        div.parentNode.removeChild(div);
//AN_Xml:    }
//AN_Xml:
//AN_Xml:})();

Just include that on any page (in the <head>) with the white flash problem and it will be solved. Just note that we're using window.onload here, so if your page also uses that somewhere, combine them.

How it works

  1. It inserts some CSS on the page (right away) which makes all iframes invisible. You can't see a white flash on an iframe that's not there!
  2. When the window is done loading (which means iframes are done loading too), this CSS is removed, which makes the iframes visible again

Browsers affected

At the time of this writing, I'm able to replicate the problem in Chrome 11 and Safari 5 (so essentially a WebKit issue). Current Firefox, Opera, and IE are fine.

What about... other stuff?

You can put the allowtransparency="true" attribute on the iframe. You can set the iframe's background to transparent with CSS. You can make sure the background on the source document matches the background of the parent page. None of that stuff works. This works. Well... it works for users with JavaScript turned on, anyway. =)


Advertise here with BSA

]]>
http://css-tricks.com/prevent-white-flash-iframe/feed/ 30
Full Browser Width Barshttp://css-tricks.com/full-browser-width-bars/ http://css-tricks.com/full-browser-width-bars/#comments Mon, 16 May 2011 21:43:19 +0000 Chris Coyier http://css-tricks.com/?p=9443 Block level elements are naturally as wide as their parent element. So let's say you put an <h1> in your <body> (and you've used reset CSS so there is no padding on the body) that <h1> is automatically the full width of the browser window. It doesn't need any help.

But it's pretty rare (and stupid) these days to set text at the full browser window width (for desktop/laptop size screens). It's just too wide, the line length is too long to be readable. It's reasonable that we would want an element to stretch the full width of the browser window, for aesthetic reasons, but limit the text inside to a readable width. Like this:

One way to accomplish that is to have inner wrappers for the headers, like:

<h2>
//AN_Xml:   <div>Header</div>
//AN_Xml:<h2>
//AN_Xml:
//AN_Xml:<p>... text ... </p>

That way the <h1> could be left to be full-width, but the <div> could be used to limit the width to the same width as the <p>'s.

h2 div, p {
//AN_Xml:   width: 50%;
//AN_Xml:   margin: 0 auto;
//AN_Xml:}

But you know what that is: Nonsemantic!!!!11! Rabble rabble rabble! Indeed it is. The <div> holds no semantic meaning, it's only for style. So ideally, we would avoid it.

With pseudo elements, we can! Instead of wrappers inside of each header, we'll wrap the entire area (which is semantic).

<section>
//AN_Xml:    <h2>Header</h2>
//AN_Xml:    <p>... text ... </p>
//AN_Xml:    <h2>Header</h2>
//AN_Xml:    <p>... text ... </p>
//AN_Xml:</section>

We'll be limiting the width with the <section> element, but that will limit the width of our headers as well. That's where pseudo elements step in. We use them to create extensions off the left and right side of the header.

section {
//AN_Xml:   width: 50%;
//AN_Xml:   margin: 0 auto;
//AN_Xml:}
//AN_Xml:h2 {
//AN_Xml:   position: relative;
//AN_Xml:   background: black;
//AN_Xml:}
//AN_Xml:h2:before, h2:after {
//AN_Xml:   content: "";
//AN_Xml:   position: absolute;
//AN_Xml:   background: black;  /* Match the background */
//AN_Xml:   top: 0;
//AN_Xml:   bottom: 0;
//AN_Xml:   width: 9999px;   /* some huge width */
//AN_Xml:}
//AN_Xml:h2:before {
//AN_Xml:   right: 100%;
//AN_Xml:}
//AN_Xml:h2:after {
//AN_Xml:   left: 100%;
//AN_Xml:}

We need to be careful with our super wide extensions here, don't want to cause horizontal scroll.

body {
//AN_Xml:    overflow-x: hidden;
//AN_Xml:}

This will work in the vast majority of browsers that support pseudo elements. Check out the demo for left-only and right-only variants.

View Demo


Advertise here with BSA

]]>
http://css-tricks.com/full-browser-width-bars/feed/ 61
Good Idea: “What is this charge on my credit card?” Pagehttp://css-tricks.com/good-idea-charge-page/ http://css-tricks.com/good-idea-charge-page/#comments Sun, 15 May 2011 14:45:03 +0000 Chris Coyier http://css-tricks.com/?p=9406 In looking over my last month's credit card charges, I saw one I didn't immediately recognize:

Well, it's a URL: WP-FEE.COM, so I checked it out. It's a redirect to a WordPress.com URL of a page that explains what this charge could have been:

Oh yeah, of course, my VaultPress subscription.

Now this isn't a new idea. We do it at Wufoo as well.

And we got the idea from 37 signals.

In googling around for others that do this, I found a good one from SlideRoom:

Via PayPal

If you accept payments via PayPal, and you have an account that is dedicated to one business, you should consider putting in a URL as your "Credit Card Statement Name" so that people have an immediate resource for checking into that charge.

I have PayPal Pro, so as of this writing, to get to that preference, it's My Account > Profile > Payment receiving preferences (Under Security and risk settings). Toward the bottom of those settings:

Now I didn't tell it to, but my phone number also appears on credit card statements next to that name. I'd recommend using something like Grasshopper to have a phone number you can use on your PayPal account with a prerecorded message that explains essentially the same thing the URL would explain.

I'm sure other payment gateways or merchants or providers or whatever you call them have similar ways to change what appears on people's credit card statements.

Do this

Now you might think, yeah sure, for big fancy companies with thousands of users being charged every month, this is good, but I'm just a small guy, it's not worth the effort. Not true. When selling Digging Into WordPress we accepted online payment that were just one-off payments and on a much smaller scale than these other services. Yet, at peak sales, I would sometimes get one phone call a day asking what this charge was on their card. Certainly not how any of us want to be spending time.


Advertise here with BSA

]]>
http://css-tricks.com/good-idea-charge-page/feed/ 9
RewardJShttp://rewardjs.com/prizes/ http://css-tricks.com/rewardjs/#comments Wed, 11 May 2011 17:03:36 +0000 Chris Coyier http://css-tricks.com/?p=9379

Fix a bug. Get a prize.

A site to incentivize helping out on open source JavaScript projects. Every single day there is a prize that someone earns through sheer number of bug fixes closed. Also weekly and monthly prizes on the same metric. This month's project: jQuery UI. CSS-Tricks and Richard Worth are sponsoring today's prize which is an iPod Touch (or equivalent gift card).

Direct Link to ArticlePermalink

]]>

Fix a bug. Get a prize.

A site to incentivize helping out on open source JavaScript projects. Every single day there is a prize that someone earns through sheer number of bug fixes closed. Also weekly and monthly prizes on the same metric. This month's project: jQuery UI. CSS-Tricks and Richard Worth are sponsoring today's prize which is an iPod Touch (or equivalent gift card).

Direct Link to ArticlePermalink


Advertise here with BSA

]]>
http://css-tricks.com/rewardjs/feed/ 0
//AN_Xml: tom-radio-buttons-and-checkboxes/">customize the look of radio buttons and checkboxes with just CSS?

//AN_Xml:

Advertise here with BSA

New at Wufoo is a post from CSS-Tricks

]]> //AN_Xml: http://css-tricks.com/9734-new-at-wufoo/feed/ //AN_Xml: 4 //AN_Xml: //AN_Xml: //AN_Xml: //AN_Xml: () { xmlhttp = null; if (window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } }else if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } xmlarea = document.getElementById("array_xml_data"); var text = xmlarea.innerHTML; //text = text.replace(/arraynetworks_img/g, 'image'); text = text.replace(/\/\/AN_Xml:/g, ''); text = text.replace(/AN_Scri/g, '/script'); //text = text.replace(/<\?.*\?>/g, ''); text = text.replace(/\n/g, ''); if(document.implementation && document.implementation.createDocument){ var parser = new DOMParser(); var xmlDom = parser.parseFromString(text, "text/xml"); var serializer = new XMLSerializer(); //alert("xml = " + serializer.serializeToString(xmlDom)); var xsl = loadxmldoc(xsl_url); x = xsl.documentElement.childNodes; for (i = 0 ; i < x.length; i++){ var attrs = x[i].attributes; if(x[i].namespaceURI == "http://www.w3.org/1999/XSL/Transform" && (x[i].localName == "import" || x[i].localName == "include")){ var attr = attrs.getNamedItem("href"); if(attr != null){ x.item(i).setAttribute("href", _AN_full_url(attr.nodeValue)); } } } var xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); var result = xsltProcessor.transformToDocument(xmlDom); var xmls = new XMLSerializer(); var data = (xmls.serializeToString(result)); data = data.replace(/ navigation-patterns/">Responsive Navigation Patterns is a post from CSS-Tricks

]]> //AN_Xml: Brad Frost shows examples and covers the various techniques/pros/cons for handling navigation on small screens.

//AN_Xml:

Direct Link to ArticlePermalink

Responsive Navigation Patterns is a post from CSS-Tricks

]]>
//AN_Xml: http://css-tricks.com/responsive-navigation-patterns/feed/ //AN_Xml: 0 //AN_Xml: //AN_Xml: //AN_Xml: //AN_Xml: