CSS3 Button Maker

来源: http://css-tricks.com/css3-button-maker/

改了几个汉字, 放到了这里: CSS3 圆角制作工具

Chris Coyier在这个工具中,  使用了一种super-awesome的方式来向文档应用hover, active等伪类.

先在头部文件中追加一个空的style标签

$("head").append("<style type='text/css'></style>");

然后使用生成后的样式,  使用jQuery的replaceWith()函数插入到文档中

$("style").replaceWith("<style type='text/css'>" + cssText + "</style>");

根据原文的叙述, 貌似加id属性后不行, 回头试试

The ripping-out part is important. Originally I tried putting an ID on the style element and replacing the content within it on the fly. It did replace the content, but those changes were not reflected on the page. Apparently in order to force the browser to re-render with the new CSS, you have to literally remove it and put it back.

XeonWell Studio