想知道是否有任何方法/技術可以讓您用類名替換媒體查詢。CSS類而不是媒體查詢
例如
.header { width: 100% }
.tablet .header { width: 50%; float: left; }
.phone .header { width: 100%; max-width: 320px;}
所以.tablet或.phone得到應用到像<html class="phone">
html標籤會不會有一種方法/編制得到這樣的工作嗎?還是需要使用JavaScript來改變元素上的類?
感謝
這將需要JavaScript。 twitter引導正在做類似他們的類。見[這裏](http://twitter.github.io/bootstrap/css/#responsive-utilities) – Dogoku
你可以用一些服務器端代碼來做到這一點,但是保持更新可能會很痛苦。這個[answer](http://stackoverflow.com/questions/8970800/is-server-side-useragent-detection-bad#answer-10063997)有一些很好的信息 – kalley
@Dogoku TW Bootstrap在媒體查詢中使用'classes' '。 –