Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 587941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:15:56+00:00 2026-05-13T15:15:56+00:00

I found a very basic web page on the Internet and now I would

  • 0

I found a very basic web page on the Internet and now I would like to do the obvious thing and add some CSS so I can build nicer pages.

  1. How can I include jQuery, as well as other style sheets?
  2. How can I include inline CSS so I can throw in a text-align: center, for example, to try out quick changes?

Regular jQuery include:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"/>

Basic Hello World server without formatting: (Updated to include static routing fix so others will be up and running quicker)


(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))

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:15:56+00:00Added an answer on May 13, 2026 at 3:15 pm

    You can include style attributes to assign your ‘inline css styles’ using syntax like:

    [:h1 {:style "background-color: black"} "Hello's Page"]
    

    You can also include a stylesheet tag and javascript using the include-css and include-js functions.

    (defn hello
      [request]
      (html ""
       [:html
         [:head
            [:title "A very long title"]
            (include-css "my css file")
            (include-js "http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js")]
         [:body
           [:div.comment
              [:h1 "Hello's Page"]
              [:p "This would look better with some CSS formatting!"]]]]))
    

    In order to serve static files like css and js files you will need to change your route statement slightly and add something like:

       (GET "/*"
        (or (serve-file "PATH_TO_FILES" (params :*)) :next))
    

    otherwise, your local css file will never get served.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found C++ FQA Lite very edificatory and would like to read more
I've found Ruby to be very attractive; I like the fact that everything is
I created a web control, and it needs some data from its parent page.
So i have this very basic ipad view controller and i was doing some
I've found it very difficult to find any existing documentation on this. What I'm
As a programmer I found it very hard to use my laptop and workstation
I recently heard of BDD and found it very similar to TDD. Which of
Since I've joined twitter I have found it very helpful to keep my finger
I found http://www.databaseanswers.org/data_models/ very useful. Any other suggestions?
I found the .net plugin architeture very complex to use as plugin platform. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.