Compress CSS code When you develop a website you know that you will always have to keep a balance between design and productivity. You need good working pages, easy layout, easy navigation, impressive design etc. PHPでCSSを圧縮して出力する方法。 ブラウザがCSSを解釈するにあたって不要な、コメントや、タブ/スペース、改行なんかを取り除いたものを出力してくれるサンプルが掲載されていました。 圧縮することで、ブラウザがCSSファイルを解釈するバイト数が減り、微少ですが解釈の高速化と、ネットワーク的負荷の低減が期待できますね。 次のサンプルコードでそれが可能です。 CSSファイル
ページのデザインを利用者好みにカスタマイズできるように、javascript を使い、CSSを切り替えることでデザイン変更できるサイトがありますが、 JavaScriptオフでも同様のことを実装したい場合のサンプル。 JavaScriptを使わずに、PHP+クッキーを使ってページのCSSを切り替えてみましょう。 PHPの知識がなくても、次のサンプルを使えば簡単に誰でもCSSを切り替えることが出来ます。 次のサンプルは、main.css , blue.css , red.css , pink.css というCSSを切り替えたい場合のサンプルです。 (1) まずは、レイアウトを保存するクッキー設定用のPHPスクリプト( index.phpとして保存 ) <?php $valids = array( "main", "blue", "red", "pink" ); $layout = (isse
PHP & CSS Dynamic Text Replacement (P C DTR) with word-wrapping PHP CSS Dynamic Text Replacement is a JavaScript-free version of the Dynamic Text Replacement method originally created by Stewart Rosenberger.PHP+CSSで見出し部分を画像で動的に美しく表示するサンプル。 <h1>タグなどで囲った見出し部分をアンチエイリアスのかかった特定フォントで次の画像のように美しく表示するサンプル。 画像なので、どのプラットフォームでも同様の見え方で表示できる上、CSSで実現しているためクリーンなHTMLによる実装が可能。 また、長い文字列が<h1>タグに指定されていても、自動で折り返されます。 H
Login / Register Username/Email password Login with Google Login with Facebook Login with GitHub Achievements GameSystem8883 won commentator badge 1 day ago hensencharles9965 won commentator badge 4 days ago 楊育承8045 won commentator badge 1 week ago shenbo9646 won commentator badge 1 week ago ChrisChen6287 won commentator badge 2 weeks ago jasan05 won commentator badge 2 weeks ago FaradayProject425
例えば、サイトに使用しているカラーとかが決まっていたとして、CSS で色を要素等に指定していくわけだけど、指定する値に変数が使えれば便利じゃね?ってのを実現したのが CSS-SSV 。 CSS-SSV // ShaunInman.com 上記サイトより css-ssv.php をダウンロードして、CSS ファイルを置いてあるディレクトリにアップ。.css の拡張子でも php と認識させられるように .htaccess で下記のように設定。 AddType application/x-httpd-php .css php_value auto_prepend_file /CSS ファイルを置いてあるディレクトリへのローカルパス/css-ssv.php 準備はこれで完了。変数を定義するには下記のような感じにする。 @server variables { BaseColor: #86B933;
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く