インターネットで非常に基本的な Web ページを見つけたので、より良いページを作成できるように、当たり前のことを行い、CSS を追加したいと考えています。
- jQuery や他のスタイル シートを含めるにはどうすればよいですか?
- たとえば、迅速な変更を試すためにtext-align: centerを挿入できるように、インライン CSS を含めるにはどうすればよいですか?
通常の jQuery には次のものが含まれます。
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"/>
フォーマットなしの基本的な Hello World サーバー: (静的ルーティングの修正を含むように更新されたので、他のサーバーはより迅速に起動して実行されます)
(ns hello-world
(:use compojure))
(defn index
[request]
(html
[:h1 "Hello World"]
[:p "This is ugly with CSS!"])
)
(defn hello
[request]
(html ""
[:title "A very long title"]
[:div.comment
[:h1 "Hello's Page"]
[:p "This would look better with some CSS formatting!"]]
))
(defroutes greeter
(GET "/" index)
(GET "/h" hello)
(GET "/*"
(or (serve-file "/opt/compojure/www/public" (params :*)) ;; This is needed to find CSS and js files
:next))
(ANY "*"
(page-not-found) ;; 404.html is in /opt/compojure/www/public/404.html
))
(run-server {:port 9090}
"/*" (servlet greeter))