我在 Internet 上找到了一个非常基本的网页,现在我想做一件显而易见的事情并添加一些 CSS,以便我可以构建更好的页面。
- 如何包含 jQuery 以及其他样式表?
- 如何包含内联 CSS,以便我可以放入text-align: center,例如,尝试快速更改?
常规 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))