diff --git a/css/README.md b/css/README.md index 490e2ee2ffa..c8dfe4ffc93 100644 --- a/css/README.md +++ b/css/README.md @@ -6,7 +6,7 @@ Our blog still looks pretty ugly, right? Time to make it nice! We will use CSS f Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a website written in markup language (like HTML). Treat it as a make-up for our webpage ;). -But we don't want to start from scratch again, right? We will, again, use something that has already been done by programmers and released in the Internet for free. You know, inventing a wheel once again is no fun. +But we don't want to start from scratch again, right? We will, again, use something that has already been done by programmers and released in the Internet for free. You know, reinventing the wheel is no fun. ## Let's use Bootstrap! @@ -16,13 +16,14 @@ It was written by programmers who worked for Twitter and is now developed by vol ## Install Boostrap -To install Bootstrap, you need to add this to your `
` in you `.html` file (`mysite/blog/templates/blog/post_list.html`): +To install Bootstrap, you need to add this to your `` in your `.html` file (`blog/templates/blog/post_list.html`): -Then just go ahead, open your website and refresh page. Here it is! +This doesn't add any files to your project. It just points to files that exist on the internet. +Just go ahead, open your website and refresh the page. Here it is! ![Figure 14.1](images/bootstrap1.png) @@ -41,7 +42,7 @@ First, we need to create a folder to store our static files in. Go ahead and cre mysite └───static -Now we need to tell Django how it can find it. Open up the `mysite/mysite/settings.py` file, scroll to the bottom of it and add the following lines: +Now we need to tell Django where it can find it. Open up the `mysite/settings.py` file, scroll to the bottom of it and add the following lines: STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"), @@ -49,36 +50,40 @@ Now we need to tell Django how it can find it. Open up the `mysite/mysite/settin This way Django will know where your static files are. -That's it! Time to see if it works :) - ## Your first CSS file! -First things first: let's create a CSS file now. Create a new folder called `css` inside your `static` folder. Then create a new file called `blog.css` inside this `css` directory. Ready? +Let's create a CSS file now, to add your own style to your web-page. Create a new folder called `css` inside your `static` folder. Then create a new file called `blog.css` inside this `css` directory. Ready? mysite └───static └───css blog.css -Time to write some CSS! Open up the `mysite/static/css/blog.css` file in your code editor. +Time to write some CSS! Open up the `static/css/blog.css` file in your code editor. We won't be going too deep into customizing and learning about CSS here, because it's pretty easy and you can learn it on your own after this workshop. We really recommend doing this [Codeacademy HTML & CSS course](http://www.codecademy.com/tracks/web) to learn everything you need to know about making your websites more pretty with CSS. -But let's do at least a little. Maybe we could change the color of our header? To understand colors, computer use special codes. They start with `#` and are followed by 6 letters (A-F) and numbers (0-9). You can find color codes for example here: http://www.colorpicker.com/ +But let's do at least a little. Maybe we could change the color of our header? To understand colors, computers use special codes. They start with `#` and are followed by 6 letters (A-F) and numbers (0-9). You can find color codes for example here: http://www.colorpicker.com/. You may also use [predefined colors](http://www.w3schools.com/cssref/css_colornames.asp), such as `red` and `green`. -In your `mysite/static/css/blog.css` file you should add following code: +In your `static/css/blog.css` file you should add following code: h1 a { color: #FCA205; } -`a` inside of `h1` (i.e. when we have in code something like: `{{ post.text }}
-All right. We have only one day, so we need to speed things up a little! We can't explain you every little detail about CSS. For now just copy and paste following code into your `mysite/static/css/blog.css` file: +We will now add declaration blocks to different selectors. Selectors starting with `.` relate to classes. There are many great tutorials and explanations about CSS on the Web to help you understand the following code. For now, just copy and paste it into your `mysite/static/css/blog.css` file: .page-header { background-color: #ff9400; @@ -205,7 +211,7 @@ All right. We have only one day, so we need to speed things up a little! We can' color: #000000; } -Then also replace this: +Then surround the HTML code which desplayes the posts with declarations of classes. Replace this: {% for post in posts %}