├── .gitignore ├── LICENSE ├── README.md ├── assets └── images │ ├── 11_1.png │ ├── 11_2.png │ ├── 12_1.png │ ├── 12_10.png │ ├── 12_2.png │ ├── 12_3.png │ ├── 12_4.png │ ├── 12_5.png │ ├── 12_6.png │ ├── 12_7.png │ ├── 12_8.png │ ├── 12_9.png │ ├── 13_1.png │ ├── 13_10.png │ ├── 13_11.png │ ├── 13_12.png │ ├── 13_13.png │ ├── 13_14.png │ ├── 13_15.png │ ├── 13_16.png │ ├── 13_17.png │ ├── 13_18.png │ ├── 13_19.png │ ├── 13_2.png │ ├── 13_3.png │ ├── 13_4.png │ ├── 13_5.png │ ├── 13_6.png │ ├── 13_7.png │ ├── 13_8.png │ ├── 13_9.png │ ├── 14_1.png │ ├── 14_10.png │ ├── 14_11.png │ ├── 14_12.png │ ├── 14_13.png │ ├── 14_14.png │ ├── 14_15.png │ ├── 14_16.png │ ├── 14_17.png │ ├── 14_18.png │ ├── 14_19.png │ ├── 14_2.png │ ├── 14_3.png │ ├── 14_4.png │ ├── 14_5.png │ ├── 14_6.png │ ├── 14_7.png │ ├── 14_8.png │ ├── 14_9.png │ ├── 15_1.png │ ├── 15_2.png │ ├── 15_3.png │ ├── 15_4.png │ ├── 1_1.png │ ├── 1_10.png │ ├── 1_11.png │ ├── 1_2.png │ ├── 1_3.png │ ├── 1_4.png │ ├── 1_5.png │ ├── 1_6.png │ ├── 1_7.png │ ├── 1_8.png │ ├── 1_9.png │ ├── 2_1.png │ ├── 2_10.png │ ├── 2_2.png │ ├── 2_3.png │ ├── 2_4.png │ ├── 2_5.png │ ├── 2_6.png │ ├── 2_7.png │ ├── 2_8.png │ ├── 2_9.png │ ├── 3_2.png │ ├── 4_1.png │ ├── 4_10.png │ ├── 4_11.png │ ├── 4_12.png │ ├── 4_13.png │ ├── 4_14.png │ ├── 4_2.png │ ├── 4_3.png │ ├── 4_4.png │ ├── 4_5.png │ ├── 4_6.png │ ├── 4_7.png │ ├── 4_8.png │ ├── 4_9.png │ ├── 5_1.png │ ├── 6_1.png │ ├── 6_2.png │ └── where-to-start.jpg ├── chapter01.adoc ├── chapter02.adoc ├── chapter03.adoc ├── chapter04.adoc ├── chapter05.adoc ├── chapter06.adoc ├── chapter07.adoc ├── chapter08.adoc ├── chapter09.adoc ├── chapter10.adoc ├── disclaimer.adoc ├── introduction.adoc ├── main.adoc └── main.html /.gitignore: -------------------------------------------------------------------------------- 1 | env 2 | code_snippets 3 | assets/CSS 4 | assets/DSA 5 | main.pdf 6 | resources.adoc 7 | notes.txt 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 by Codexplore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Super Crash Course in Full Stack Programming with Python and Django 2 | 3 | Thank you for checking out my book. 4 | I am very excited to finally release this, and appreciate all of the input I will get. 5 | The goal of this book is to split up different subjects into modules (as much as possible) so that each chapter can be used independently as a reference. 6 | So, if someone knows the front end, they can skip right to the Django chapters. 7 | I also want to make sure it is as clear as possible. 8 | If there are any questions, please let me know. 9 | As of March 3, 2019, this is the first beta release, so I am guessing there will be many changes. 10 | 11 | I skipped over a lot of the installation items because there are plenty of sources that explain it, and there is very little difference in how I can explain it. 12 | However, if you think it would add value to it, please let me know. 13 | 14 | The next version will have the following concepts: 15 | 1. Error Handling in Python 16 | 2. Explanation of importing files in Python 17 | 3. Lambdas 18 | 4. Explanation of Static and Media 19 | 5. Add required explanation for Html tags 20 | 6. Going into Class Based Views 21 | 7. Security Measures 22 | 8. Signals 23 | 9. More in depth user model 24 | 10. Django forms 25 | 11. Add an appendix for a giant list of resources. 26 | 12. Virtual Environments 27 | 13. More in depth conversation regarding Django versions 28 | 29 | I would also like to know if people think Javascript would be useful to include in this. 30 | 31 | My next book if going to be on using React with Django (DRF). 32 | If you think that there is a better subject, please let me know, www.codexplore.io/contact. 33 | 34 | To read on our website, go to www.codexplore.io/books/crash-course 35 | -------------------------------------------------------------------------------- /assets/images/11_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/11_1.png -------------------------------------------------------------------------------- /assets/images/11_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/11_2.png -------------------------------------------------------------------------------- /assets/images/12_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_1.png -------------------------------------------------------------------------------- /assets/images/12_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_10.png -------------------------------------------------------------------------------- /assets/images/12_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_2.png -------------------------------------------------------------------------------- /assets/images/12_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_3.png -------------------------------------------------------------------------------- /assets/images/12_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_4.png -------------------------------------------------------------------------------- /assets/images/12_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_5.png -------------------------------------------------------------------------------- /assets/images/12_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_6.png -------------------------------------------------------------------------------- /assets/images/12_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_7.png -------------------------------------------------------------------------------- /assets/images/12_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_8.png -------------------------------------------------------------------------------- /assets/images/12_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/12_9.png -------------------------------------------------------------------------------- /assets/images/13_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_1.png -------------------------------------------------------------------------------- /assets/images/13_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_10.png -------------------------------------------------------------------------------- /assets/images/13_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_11.png -------------------------------------------------------------------------------- /assets/images/13_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_12.png -------------------------------------------------------------------------------- /assets/images/13_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_13.png -------------------------------------------------------------------------------- /assets/images/13_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_14.png -------------------------------------------------------------------------------- /assets/images/13_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_15.png -------------------------------------------------------------------------------- /assets/images/13_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_16.png -------------------------------------------------------------------------------- /assets/images/13_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_17.png -------------------------------------------------------------------------------- /assets/images/13_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_18.png -------------------------------------------------------------------------------- /assets/images/13_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_19.png -------------------------------------------------------------------------------- /assets/images/13_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_2.png -------------------------------------------------------------------------------- /assets/images/13_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_3.png -------------------------------------------------------------------------------- /assets/images/13_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_4.png -------------------------------------------------------------------------------- /assets/images/13_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_5.png -------------------------------------------------------------------------------- /assets/images/13_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_6.png -------------------------------------------------------------------------------- /assets/images/13_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_7.png -------------------------------------------------------------------------------- /assets/images/13_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_8.png -------------------------------------------------------------------------------- /assets/images/13_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/13_9.png -------------------------------------------------------------------------------- /assets/images/14_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_1.png -------------------------------------------------------------------------------- /assets/images/14_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_10.png -------------------------------------------------------------------------------- /assets/images/14_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_11.png -------------------------------------------------------------------------------- /assets/images/14_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_12.png -------------------------------------------------------------------------------- /assets/images/14_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_13.png -------------------------------------------------------------------------------- /assets/images/14_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_14.png -------------------------------------------------------------------------------- /assets/images/14_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_15.png -------------------------------------------------------------------------------- /assets/images/14_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_16.png -------------------------------------------------------------------------------- /assets/images/14_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_17.png -------------------------------------------------------------------------------- /assets/images/14_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_18.png -------------------------------------------------------------------------------- /assets/images/14_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_19.png -------------------------------------------------------------------------------- /assets/images/14_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_2.png -------------------------------------------------------------------------------- /assets/images/14_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_3.png -------------------------------------------------------------------------------- /assets/images/14_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_4.png -------------------------------------------------------------------------------- /assets/images/14_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_5.png -------------------------------------------------------------------------------- /assets/images/14_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_6.png -------------------------------------------------------------------------------- /assets/images/14_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_7.png -------------------------------------------------------------------------------- /assets/images/14_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_8.png -------------------------------------------------------------------------------- /assets/images/14_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/14_9.png -------------------------------------------------------------------------------- /assets/images/15_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/15_1.png -------------------------------------------------------------------------------- /assets/images/15_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/15_2.png -------------------------------------------------------------------------------- /assets/images/15_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/15_3.png -------------------------------------------------------------------------------- /assets/images/15_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/15_4.png -------------------------------------------------------------------------------- /assets/images/1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_1.png -------------------------------------------------------------------------------- /assets/images/1_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_10.png -------------------------------------------------------------------------------- /assets/images/1_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_11.png -------------------------------------------------------------------------------- /assets/images/1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_2.png -------------------------------------------------------------------------------- /assets/images/1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_3.png -------------------------------------------------------------------------------- /assets/images/1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_4.png -------------------------------------------------------------------------------- /assets/images/1_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_5.png -------------------------------------------------------------------------------- /assets/images/1_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_6.png -------------------------------------------------------------------------------- /assets/images/1_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_7.png -------------------------------------------------------------------------------- /assets/images/1_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_8.png -------------------------------------------------------------------------------- /assets/images/1_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/1_9.png -------------------------------------------------------------------------------- /assets/images/2_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_1.png -------------------------------------------------------------------------------- /assets/images/2_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_10.png -------------------------------------------------------------------------------- /assets/images/2_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_2.png -------------------------------------------------------------------------------- /assets/images/2_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_3.png -------------------------------------------------------------------------------- /assets/images/2_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_4.png -------------------------------------------------------------------------------- /assets/images/2_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_5.png -------------------------------------------------------------------------------- /assets/images/2_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_6.png -------------------------------------------------------------------------------- /assets/images/2_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_7.png -------------------------------------------------------------------------------- /assets/images/2_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_8.png -------------------------------------------------------------------------------- /assets/images/2_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/2_9.png -------------------------------------------------------------------------------- /assets/images/3_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/3_2.png -------------------------------------------------------------------------------- /assets/images/4_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_1.png -------------------------------------------------------------------------------- /assets/images/4_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_10.png -------------------------------------------------------------------------------- /assets/images/4_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_11.png -------------------------------------------------------------------------------- /assets/images/4_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_12.png -------------------------------------------------------------------------------- /assets/images/4_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_13.png -------------------------------------------------------------------------------- /assets/images/4_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_14.png -------------------------------------------------------------------------------- /assets/images/4_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_2.png -------------------------------------------------------------------------------- /assets/images/4_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_3.png -------------------------------------------------------------------------------- /assets/images/4_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_4.png -------------------------------------------------------------------------------- /assets/images/4_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_5.png -------------------------------------------------------------------------------- /assets/images/4_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_6.png -------------------------------------------------------------------------------- /assets/images/4_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_7.png -------------------------------------------------------------------------------- /assets/images/4_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_8.png -------------------------------------------------------------------------------- /assets/images/4_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/4_9.png -------------------------------------------------------------------------------- /assets/images/5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/5_1.png -------------------------------------------------------------------------------- /assets/images/6_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/6_1.png -------------------------------------------------------------------------------- /assets/images/6_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/6_2.png -------------------------------------------------------------------------------- /assets/images/where-to-start.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codexplore-io/crash-course-django/d5cee4e61960532bfe9a308dfc528872138167a4/assets/images/where-to-start.jpg -------------------------------------------------------------------------------- /chapter01.adoc: -------------------------------------------------------------------------------- 1 | == HTML 2 | === What is HTML? 3 | HTML, or Hypertext Markup Language is the language of the internet. 4 | When you open up a web page, you are essentially opening up a .html file. 5 | The browser "converts" the markup that you write in your text editor to a user friendly format. 6 | 7 | Think about a .doc or .docx file. 8 | When you are creating a .doc or .docx file, you are using a word processor to actually show the content of your file, such as Microsoft Word. 9 | If you were to open your file in Notepad, for example, it would look very different. 10 | But - it is the same file! It is just using a different program to display it. 11 | 12 | That is the same with a browser. 13 | A browser takes your .html file and creates the user friendly version of it. 14 | You could open the .html file in Notepad, or any text editor, and it will look much different. 15 | That is what learning how to programing in HTML is - working in a text editor to display something to a browser for an end user. 16 | 17 | NOTE: You may see the word "client" throughout this book or on other learning platforms. 18 | The client is also known as the user. 19 | Furthermore, when we say "client side," we mean the part of the website that the user, or client, sees. 20 | "Client side" and "Front End" are essentially interchangeable. 21 | 22 | This chapter will be very visual, so if you like pictures, this is the chapter for you. 23 | I will be showing you snippets of code, but I will also show you how it should look in your browser. 24 | 25 | === How to Use HTML 26 | HTML is very, very easy to get started with, so let's jump right in. First, create a new text document. 27 | In Windows, this can be done by right clicking on your desktop, going to "New" then clicking "Text Document". 28 | You can name the document whatever you would like. 29 | 30 | Now that you have created it, you can double click to open it. 31 | Once you have it open, click "File" then "Save-As". 32 | In the "File name" input, type "Webpage.html". 33 | Then, in the "Save as type" input, click the drop down and select "All Files" 34 | Finally, click "Save." 35 | 36 | [#img-11] 37 | [.text-center] 38 | .Creating a new text document 39 | image::1_1.png[Creating a new text document] 40 | 41 | [#img-12] 42 | [.text-center] 43 | .Save as .html 44 | image::1_2.png[Save a document as .html] 45 | 46 | Congratulations! you have just created your first .html document! 47 | Type the following code in your html file and save it: 48 | 49 | [literal] 50 |

Hello World!

51 | 52 | Next copy and past the path that your file is saved in and paste it in the URL in your browser. 53 | You should see the following in your browser: 54 | 55 | [#img-13] 56 | [.text-center] 57 | .Hello World in Browser 58 | image::1_3.png[Hello World in Browser, 500, auto] 59 | 60 | You are now a web developer! 61 | Right now, you are essentially hosting your web page, called "Webpage.html" on your own computer. 62 | Websites are similar - they just save it on another location. 63 | Then, when you go to a website, the browser will show whatever .html file is at that location. 64 | In the case of the above example, the file is located at C:/Users/tanner/desktop/webpage.html. 65 | 66 | Now, let's dive into HTML a little more. 67 | HTML documents are broken up into different elements. 68 | One example of an element is an `

` element (called a *tag*). 69 | The `

` tag is one of the most basic HTML tags, and it is formatted as a large heading in a web page (Heading 1). 70 | 71 | ==== Self Closing vs Non-Self Closing Tags 72 | As you saw, there are three parts of the `

` tag. 73 | 74 | 1. The opening part: `

`. This part opens the tag and lets you know that the following content will be a Heading 1. 75 | 2. The content: `Hello World`. This part is the actual meat of the element. 76 | 3. The closing tag: `

`. This closes the tag, so the content is wrapped between these two snippets. Everything outside these snippets will be formatted in their own way. 77 | 78 | Generally speaking, tags will have an opening and closing element. 79 | For example, if you wanted a Heading 2 element, you would type the following: 80 | 81 | [literal] 82 |

Hello World!

83 | 84 | I encourage you to type that into your .html file, resave and refresh your browser to see what happens. 85 | 86 | Not all tags will require the ending tag. 87 | There are some tags that are self closing, such as the `` tag. 88 | In these cases, there is no content to be wrapped, and all code will be put within the tag. 89 | We will see both throughout this chapter, so it is important to know that this is common, and it will make more sense as we go along. 90 | 91 | === Common Tags 92 | We briefly introduced tags in the last chapter, so we will go more in depth of ones that you will likely use in your programming career. 93 | Let's first start off with how to properly create an .html document. 94 | The entire .html file should always be wrapped in a `` tag. 95 | Within the `` tag, there are two other tags, the `` and `` tags. 96 | Put the following code in your "Webpage.html" file: 97 | 98 | [literal] 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | The `` tag is basically used to tell the browser that this is indeed an html document. 109 | We see two more elements, the `` tag and the `` tag. 110 | The `` tag is where most of the high level html content will go. 111 | A great analogy I have heard before is to think of the `` tag as your head. 112 | That is where all of your higher level thinking goes. 113 | 114 | The `` tag is where the rest of the content goes. 115 | This is where the content will go that the user/client will see. 116 | For beginning HTML-ers, we will mainly be focused on the `` tag. 117 | At this moment, your webpage is empty. There is no actual content, just empty elements. 118 | 119 | 120 | The one exception for the time being is the `` tag. 121 | Within the `<head>` tag, the `<title>` tag will change the actual name of the html document that appears in your browser. 122 | In Google Chrome, this will be what appears on the tab. 123 | Right now, it is just "Webpage.html". 124 | 125 | If you change your code in the `<head>` tag to the following: 126 | 127 | [literal] 128 | <head> 129 | <title>My Webpage 130 | 131 | 132 | You will see that the name in your tab is now "My Webpage". 133 | 134 | There are a lot of tags in HTML. 135 | Remember the Ten Commandments of Coding: Try not to get intimidated when looking at new code. 136 | This will be showing you a lot of them, but do not worry if you cannot memorize them right away. 137 | That will come with time while you practice. 138 | 139 | ==== Heading and Paragraph Tags 140 | We have already looked at `

` tags. 141 | This element will be the largest of the Headings in your project. 142 | HTML actually has 6 Heading elements, which are `

` through `

`. 143 | A common way to see this is to type the following within the `` in your html document. 144 | See https://www.w3schools.com/html/tryit.asp?filename=tryhtml_headings[W3 Schools] to interactively learn this. 145 | 146 | [literal] 147 |

This is a Heading 1 Element.

148 |

This is a Heading 2 Element.

149 |

This is a Heading 3 Element.

150 |

This is a Heading 4 Element.

151 |
This is a Heading 5 Element.
152 |
This is a Heading 6 Element.
153 |

This is a Paragraph Element.

154 | 155 | Your webpage should now look like the following: 156 | [#img-14] 157 | [.text-center] 158 | .Headings 159 | image::1_4.png[Headings, 500, auto] 160 | 161 | Cool, right? 162 | This is a simple way to change the size of your text in a web page. 163 | Notice I put in a `

` tag in as well. 164 | This tag is very common and is used to type normal text. 165 | We will learn in the following chapters how exactly to format a better website, but this is great for now. 166 | 167 | ==== Styling Tags 168 | From now on, we will be using `

` to write our normal text. 169 | HTML has support for simple styling of your text including bold and italic. 170 | As you have seen before, we can nest elements inside of each other. 171 | The `` and `` elements are inside the `` element, and we put more content within the `` element. 172 | We can go further by putting more tags within a paragraph element. 173 | 174 | [literal] 175 |

Sometimes I like to bold text and other times I like to italicize text.

176 | 177 | If you put this into your "Webpage.html", save it and refresh your browser, it will look like this: 178 | [#img-15] 179 | [.text-center] 180 | .Styling 181 | image::1_5.png[Styling, 500, auto] 182 | 183 | As you can see, the `` tag will bold any text within it and the `` tag will italicize any text within it. 184 | 185 | === Links and Images 186 | 187 | ==== Links 188 | Links are going to be another very common element in your webpage. 189 | A *link* is simply a way to navigate to another webpage, whether it is part of your website or an external webpage. 190 | The way to do this is using the `` tag. 191 | Before we can jump in, however, we need to learn another concept - tag attributes. 192 | 193 | An *attribute* is code that is put within the tag itself. 194 | Attributes is where we really start to see the power of HTML. 195 | Look at the following code, for example: 196 | 197 | [literal] 198 | Go to Google 199 | 200 | Let's dissect this code. 201 | The content is "Go to Google". 202 | This will be what appears as text in your webpage. 203 | However, what does "href" mean? 204 | This is an attribute that tells the hyperlink where to go when the content is clicked. 205 | If you put the above code in your webpage, save and refresh your browser, you should see the following: 206 | 207 | [#img-16] 208 | [.text-center] 209 | .Hyperlink 210 | image::1_6.png[Hyperlink, 500, auto] 211 | 212 | You now have a link that will take you to Google! 213 | 214 | NOTE: You will need to add "http://" or "https://" before your link in the `href` attribute in order to go to an external website. 215 | Otherwise, it will assume it is located in the same location you are. 216 | Try to remove the "https://" before "www.google.com" and see what happens when you click your link. 217 | This will make more sense as we go through the book. 218 | 219 | I suggest practicing with a few different `` tags to learn how it works with different websites. 220 | 221 | ==== Images 222 | Images are the first self closing tag we will look at. 223 | It is denoted by the following: 224 | 225 | [literal] 226 | 227 | 228 | It uses an attribute `src`, which tells the tag where the image is and the name of the image. 229 | It assumes that the image is in the same folder that the html file is. 230 | Once we start building larger webpages, we will look into this more. 231 | At this point, it just adds the "beach.jpeg" source to the end of the current directory. 232 | This makes sense with the note in the previous section about links. 233 | 234 | I have a file called "beach.jpeg" in the same folder as my "Webpage.html" file, so when I put that code in my file, I get the following: 235 | [#img-19] 236 | [.text-center] 237 | .Image 238 | image::1_9.png[Image, 500, auto] 239 | 240 | === Lists 241 | What if you want to make a list of items? 242 | Well, HTML has something for that. 243 | There are two types of lists - ordered lists and unordered lists. 244 | 245 | ==== Ordered Lists 246 | 247 | An ordered list is a list of items that is numbered. 248 | The syntax is as follows: 249 | 250 | [literal] 251 |
    252 |
  1. My First Item
  2. 253 |
  3. My Second Item
  4. 254 |
  5. My Third Item
  6. 255 |
256 | 257 | You wrap your list with the `
    ` and create each list item by wrapping them in `
  1. `. 258 | 259 | When you refresh your browser, you should see the following: 260 | [#img-17] 261 | [.text-center] 262 | .Ordered List 263 | image::1_7.png[Ordered List, 500, auto] 264 | 265 | You now have a list of items that are numbered. 266 | 267 | ==== Unordered Lists 268 | 269 | Unordered Lists have similar syntax, but will create a bulleted list. 270 | 271 | [literal] 272 |
      273 |
    • My First Item
    • 274 |
    • My Second Item
    • 275 |
    • My Third Item
    • 276 |
    277 | 278 | The only difference is the outside wrapping tag. It is `
      ` instead of `
        `. 279 | Lists can have as many items as you would like. 280 | 281 | === Tables 282 | What if you want a table? 283 | That is also very easy in HTML. 284 | A table is simply the intersection of rows and columns that create cells. 285 | In HTML, you can create a table with the following code: 286 | 287 | [literal] 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 |
        CityState/RegionCountry
        Los AngelesCaliforniaUnited States
        PraguePragueCzech Republic
        RomeLazioItaly
        310 | 311 | Let's break that down a little bit. 312 | The entire table is created using `
        `. 313 | Then, within that, there are rows of the table, denoted by ``. 314 | The number of columns is given by how many data points are in each row, `
        `. 315 | In this case, there are three columns. 316 | The heading of each column are denoted by ``. 317 | This is the name of the column, and by default, HTML makes this stick out. 318 | Your webpage should look like this now. 319 | 320 | [#img-18] 321 | [.text-center] 322 | .Table 323 | image::1_8.png[Table, 500, auto] 324 | 325 | Now that we have tables, we can move onto forms, one of the most important features you will need to know for web development. 326 | 327 | === Forms 328 | You will use forms a lot while you are developing websites. 329 | Forms are everywhere on the internet, from the place you type in your Google search to when you log into your e-mail account. 330 | Forms are created using the `
        ` tag and all of the inputs are `` tags. 331 | The `` tag is another self closing tag, and has an attribute of `type`. 332 | By defining the type, you will output different types of inputs. 333 | That does not make sense without an example, so let's look at the following text: 334 | 335 | [literal] 336 | 337 |

        Username

        338 | 339 |

        E-mail

        340 | 341 |

        Password

        342 | 343 |

        Date

        344 | 345 |
        346 | 347 | 348 |
        349 | 350 | Before we go forward, I want to introduce a new tag, `
        `. 351 | This tag will create a new line in your webpage. 352 | 353 | Now, let's look at the types of inputs. 354 | 355 | 1. `text`: This is a simple input that takes plain text. 356 | 2. `email`: This is similar to the text input. However, it is a new type that will validate whether or not you have an email address in the input. When you click "submit", it will check if it is in the format of an email address. 357 | 3. `password`: Password type will create a hidden input so people cannot see your password when you are typing it in. 358 | 4. `date`: A choice of dates. 359 | 5. `reset`: It will empty the current form. 360 | 6. `submit`: It will submit the current field. This has another attribute called value, which will show what text to put in the button. 361 | 362 | The `placeholder` attribute says what text will be in the input temporarily until the User begins input. 363 | At this point, your webpage should look like the following: 364 | 365 | [#img-110] 366 | [.text-center] 367 | .Form 368 | image::1_10.png[Form, 500, auto] 369 | 370 | We will look at a few more input types - radio and check boxes. 371 | 372 | ---- 373 |
        374 | Option 1
        375 | Option 2
        376 | Option 3 377 |
        378 | 379 |
        380 | Option 1
        381 | Option 2
        382 | Option 3
        383 |
        384 | ---- 385 | 386 | Radio buttons have radio inputs that will only allow one choice for each group, by default. 387 | Checkbox buttons will allow more than one option for each group, by default. 388 | 389 | The value attribute will tell the database what value the user is returning. 390 | The name attribute tells the database what form is being used. 391 | Note that we appended the Options at the end of the input. 392 | This is just for a user experience, so that the content for "Option 1", "Option 2" and "Option 3" have a corresponding User Interface with the `value` attribute. 393 | When we start dealing with back end development, this will start making more sense, as the values will correspond to the data in the database. 394 | 395 | Your webpage should look like the following: 396 | 397 | [#img-111] 398 | [.text-center] 399 | .Radio and Check Boxes 400 | image::1_11.png[Radio and Check Boxes, 500, auto] 401 | 402 | === End of Chapter 403 | We have covered a lot in this chapter. 404 | Do not feel like you need to memorize everything at once. 405 | Many things we learned will be used more than others, so it will just come with practice. 406 | There are a few very important tags that we still need to cover, but it would not make as much as sense without CSS, which we will cover in the next chapter. 407 | -------------------------------------------------------------------------------- /chapter02.adoc: -------------------------------------------------------------------------------- 1 | == CSS 2 | === What is CSS? 3 | CSS, or Cascading Style Sheets, is what makes websites look good. 4 | You can think of HTML as the person, and CSS as the clothing. 5 | CSS adds styling to otherwise boring websites. 6 | 7 | [#img-21] 8 | [.text-center] 9 | .Google without styles 10 | image::2_1.png[Google without styles] 11 | 12 | Using Chrome's development tools, I very cumbersomely and grotesquely started deleting the CSS files and Javascript files (we will learn more in later chapters). 13 | What you see on the left side is basically the same HTML, but it does not have many of the CSS and Javascript files. 14 | You will see the same HTML tags and elements, but the format, layout and style of the website will look much different. 15 | In Safari, you can easily select to disable the stylesheets, and you can do this yourself. 16 | 17 | This chapter will be very visual, like the last one. 18 | CSS is still part of Front End Development, so changes will be directly visible in the browser. 19 | Let's get started! 20 | 21 | === Divs, Spans, Ids and Classes 22 | ==== Divs and Spans 23 | As we said at the end of the last chapter, there were some tags that we did not cover yet. 24 | Those two tags are `
        ` and ``. 25 | Both tags are used to separate different content for styling purposes. 26 | `
        ` is generally used for larger blocks of code, while `` is typically used for short chunks of code (a sentence or less). 27 | They can work together as the following: 28 | 29 | [literal] 30 |
        31 | This text is in the div, but outside of the span. 32 | This text is inside of the div and the span. 33 |
        34 |
        35 | This text is in the second div, but outside of the second span. 36 | This text is inside of the second div and the second span. 37 |
        38 | 39 | The code results in the following: 40 | [#img-22] 41 | [.text-center] 42 | .Divs and Spans 43 | image::2_2.png[Divs and Spans] 44 | 45 | Notice how the code is shown on the page. 46 | There is no real styling, but the second div does go to another line, while the spans stay on the same line. 47 | This is because of the *display* property. 48 | Each html tag has different properties and corresponding values for those properties in CSS. 49 | So, display is a CSS property that says how the elements will behave from a layout basis. 50 | 51 | A `
        ` has a default display value of `block`. 52 | This means that it will take up its own line. 53 | If we have three `
        ` tags, one after another, by default they will take up their own line, and the next `
        ` will go to the next line, as we can see in Figure 13. 54 | 55 | `` elements have a default display value of `inline`. 56 | Inline elements will just flow with the page. 57 | In the previous example, the `` within the `
        ` stays on the same line as the other content within the `div`. 58 | 59 | The display property is very important to keep in mind and can result in a lot of anger when trying to get a layout designed in a web page (not speaking from personal experience, of course). 60 | Another possible value for display is `inline-block`. 61 | An `inline-block` element behaves as an `inline` element, but it is more flexible. 62 | We will see more of this as we go along. 63 | Another value is `none`. 64 | A display value of `none` does exactly what it sounds like; it will remove the element from view. 65 | 66 | ==== IDs and Classes 67 | Ids and classes are HTML tag attributes that can help add style to an element. 68 | It allows a programmer to refer to a specific element (often time a div or a span) or group of elements to apply styling to them. 69 | 70 | [literal] 71 |
        72 | My text 73 |
        74 | 75 | I can then go into CSS and refer to the `div` called "red-background" and the span called "text". 76 | Classes are typically used for more than one item, and IDs are used when you are referring to one specific element. 77 | 78 | === CSS Syntax 79 | All that is great, but what does this mean for me? How do I actually start using classes and ids to style? 80 | Create a new .html file and type the following: 81 | 82 | [literal] 83 | 84 | 85 | 87 | 88 | 89 |
        90 | My text 91 |
        92 | 93 | 94 | 95 | We have introduced the ` 112 | 113 | Let's walk through this. 114 | In order to refer to a class in our CSS, we type a `.` then the class name. 115 | In order to refer to an id, we type a `#` then the id name. 116 | After we choose our class or id, we create a code block for all of our styles for that class or id, by using curly braces. 117 | Within these curly braces, we put property, value pairs, separated by a colon, and then finished by a semi-colon. 118 | We can put as many property, value pairs as we want in each block. 119 | 120 | The red-background class has a `background-color` property, for which its value is `red`. 121 | The text id has a `color: white;` style, which sets the color of the font. 122 | 123 | If you save your html file and refresh your browser, you will see the following: 124 | [#img-23] 125 | [.text-center] 126 | .CSS Styling 127 | image::2_3.png[CSS Styling, 500, auto] 128 | 129 | Notice how the red color spans the entire width of the browser. 130 | This is because the `div` is a block element, and takes up an entire line. 131 | So, it will fill the entire `div` with a background color of red. 132 | Try deleting the `background-color` property in the class and put it in the `text` id styling and see what happens. 133 | 134 | As we saw, CSS has a specific syntax. Generally speaking, the syntax is 135 | 136 | ---- 137 | tag-name{ 138 | property-1: value-1; 139 | property-2: value-2; 140 | ... 141 | property-n: value-n; 142 | } 143 | .class-name{ 144 | property-1: value-1; 145 | property-2: value-2; 146 | ... 147 | property-n: value-n; 148 | } 149 | #id-name{ 150 | property-1: value-1; 151 | property-2: value-2; 152 | ... 153 | property-n: value-n; 154 | } 155 | ---- 156 | 157 | Note the first example - you can also add styles to an entire tag, such as a `div` or `span`. 158 | You can have as many properties as you want and you can name your classes and ids whatever you want, although there are naming conventions that we will cover. 159 | At this point, you just want it to be very clear what your class does and which element your id refers to. 160 | 161 | ==== Internal, Inline and External CSS 162 | A quick aside - CSS can be created in the same file, called internal CSS. 163 | This uses the ` 485 | 486 | 487 |
        488 | This content is static. 489 |
        490 |
        491 | This is content relative. 492 |
        493 | This is content absolute. 494 |
        495 |
        496 |
        497 | This content is fixed. 498 |
        499 | 500 | 501 | 502 | The code results in the following: 503 | 504 | [#img-27] 505 | [.text-center] 506 | .Positioning 507 | image::2_7.png[Positioning, 500, auto] 508 | 509 | The static content is first and is just in the normal flow of the page. 510 | The top value has no effect on it. 511 | 512 | The relative content is relative to its normal position. 513 | It should have come right after the static content. 514 | However, there is now a gap of `3rem`, which shifts the content down `3rem`. 515 | 516 | The absolute content will shift relative to the nearest `position: relative` parent. 517 | So, it is shifted down `3rem` relative to the top of the `div-relative`. 518 | You can confirm the relative and absolute behavior by looking at the gap between the bottom of the static content and the top of the relative content, then the top of the relative content to the top of the absolute content. 519 | The lengths are both `3rem`. 520 | 521 | Finally, the fixed content is fixed at `95%` of the viewport. 522 | It will always stay there and has a gap of `95%` of the viewport height above it. 523 | 524 | ==== Float 525 | The `float` property is a great way to position content. 526 | It specifics where to place the content within its container. 527 | It takes the values `left`, `right`, `inherit` and `none`. 528 | 529 | Generally speaking, you should always use `position: relative` when using float, because it is a property that will position something relative to the parent. 530 | Let's say we have the following html: 531 | 532 | [literal] 533 |
        534 |
        535 | Right Content 536 |
        537 |
        538 | Left Content 539 |
        540 |
        541 | 542 | Normally, you would see the right content come before the left content. 543 | However, let's add the following CSS: 544 | 545 | ---- 546 | .right-content{ 547 | float: right; 548 | } 549 | .left-content{ 550 | float: left; 551 | } 552 | ---- 553 | 554 | Now, the right content will go to the right and the left content will go to the left. 555 | 556 | [#img-210] 557 | [.text-center] 558 | .The left browser does not have the float properties set, the right one has them set with the preceding code 559 | image::2_10.png[Float, 500, auto] 560 | 561 | ==== Fonts 562 | There are a few ways to adjust the font of a page. 563 | Let's first focus on `font-size`. 564 | We can use any of the units to define this. 565 | 566 | ---- 567 | font-size:1rem; 568 | ---- 569 | or 570 | ---- 571 | font-size:10px; 572 | ---- 573 | These will change the size of the font to `1rem` or `10px` respectively. 574 | 575 | We can also change the actual font of the element, using `font-family`. 576 | https://fonts.google.com/[Google Fonts] is great for this, and will actually walk you through how to use it. 577 | For example, go to Google Fonts. 578 | Search for the "Roboto" font. 579 | Click on the "+". 580 | 581 | This will give you what you need to define in your webpage. 582 | First, you will need a stylesheet, which is provided in Google Fonts. 583 | 584 | ---- 585 | 586 | ---- 587 | 588 | This is the stylesheet for the "Roboto" font. 589 | You can put this in the `` along with the rest of your stylesheets. 590 | Then, you can copy and paste the `font-family` property from Google Fonts. 591 | 592 | ---- 593 | font-family: 'Roboto', sans-serif; 594 | ---- 595 | 596 | Now, we are good to go. 597 | This specifies the font that will be used for the element. 598 | 599 | ==== Color 600 | When you want to change the color of an element, you can change the background color or the font color. 601 | You can use two different properties to change the color of these parts of an html element. 602 | 603 | First, you can change the background color of the element. 604 | In order to do that, you use (guess what!) the `background-color` property. 605 | 606 | [literal] 607 | background-color: rgb(154, 234, 122); 608 | 609 | The `background-color` property will change the background of the element up to the borders - that means the content itself and the padding. 610 | 611 | You can also change the color of the font using the `color` property. 612 | 613 | For example, the following code will create a class with white text and black background. 614 | 615 | ---- 616 | .black-white{ 617 | background-color: black; 618 | color: white; 619 | } 620 | ---- 621 | 622 | Remember: `color` will change the color of the content and `background-color` will change the background color. 623 | 624 | ==== Text Align 625 | Most of the time, you want to be able to align your content in a certain way. 626 | This is where the `text-align` property comes into play. 627 | 628 | `text-align` helps do exactly what is sounds like. 629 | It will help align text within an element. 630 | 631 | Let's say we have the following html code: 632 | 633 | [literal] 634 |
        635 | Center Text 636 |
        637 | 638 | And let's say class `text-align` has the following CSS. 639 | 640 | ---- 641 | .text-align{ 642 | border: 2px solid black; 643 | display: block; 644 | text-align: center; 645 | } 646 | ---- 647 | 648 | We know that the element will span the entire width of the browser because of `display: block;`. 649 | The content "Center Text" will be in the center of element which will be in the center of the browser. 650 | 651 | What happens when we change display to inline? 652 | It will only take up the room of its content, so it will stay on the left side of the browser. 653 | The following figure shows what happens to the `div` with `class="text-align"` with `display: block` on the left and `display: inline` on the right. 654 | 655 | [#img-28] 656 | [.text-center] 657 | .`text-align` 658 | image::2_8.png[`text-align`, 500, auto] 659 | 660 | However, if we changed the padding of the inline element, the content would be centered within the padding, per the box model. 661 | Let's change the CSS: 662 | 663 | ---- 664 | .text-align{ 665 | border: 2px solid black; 666 | display:inline; 667 | text-align:center; 668 | top: 3rem; 669 | position: relative; 670 | padding: 2rem; 671 | } 672 | ---- 673 | 674 | We added the `position` and `top` properties just so you could see the top border clearly in the browser. 675 | Now, we get the following: 676 | 677 | [#img-29] 678 | [.text-center] 679 | .Inline with padding 680 | image::2_9.png[Inline with padding, 500, auto] 681 | 682 | `text-align` can also have values of `left`, `right` and `justify`. 683 | 684 | TIP: It is common to set `text-align: center` for parent elements so that all of the elements within are centered. 685 | -------------------------------------------------------------------------------- /chapter03.adoc: -------------------------------------------------------------------------------- 1 | == Responsive Design and Bootstrap 2 | Responsive Design is an integral part to modern web design. 3 | Responsive Design refers to a design philosophy that allows a website or web app to look great on screens of all sizes. 4 | Before mobile devices, this was not much of a consideration. 5 | However, as time has gone on, mobile devices and other devices that do not have the same screen size/proportions as normal desktops/laptops have become more and more common. 6 | It is therefore extremely important to create websites that are responsive - that is, responds to changes in the size of the screen. 7 | Let's look at an example. 8 | 9 | W3Schools.com implements responsive design. 10 | On a normal screen, the website looks like this: 11 | 12 | [#img-41] 13 | [.text-center] 14 | .Desktop View W3 Schools 15 | image::4_1.png[Desktop View W3 Schools] 16 | 17 | This is no surprise - it has been seen before. 18 | However, when we look at it on a mobile device, it looks like this: 19 | 20 | [#img-4_2] 21 | [.text-center] 22 | .Mobile View W3 Schools 23 | image::4_2.png[Mobile View W3 Schools] 24 | 25 | The mobile view is much different than the desktop view: the content becomes stacked on top of each other so it can be easily viewable in the width of the screen. 26 | In addition, the navbar has collapsed, to be expanded when you click the three bars at the top of the screen. 27 | This is a common responsive design tactic for the navbar. 28 | We will go into media queries and then learn Bootstrap, a front end framework developed by Twitter that makes responsive design very easy to implement. 29 | 30 | === Media Queries 31 | A media query is how you can set different styles based on different screen sizes. 32 | In your CSS, you will define all of your styles. 33 | Then, you will create media queries which specify the styles you want in different screen sizes. 34 | So, let's say we have the following code: 35 | 36 | ---- 37 | 38 | 39 | 44 | 45 | 46 |
        47 | This content is within a responsive class. 48 |
        49 | 50 | 51 | ---- 52 | 53 | It should not surprise you that it will look like the following in the browser: 54 | 55 | [#img-4_3] 56 | [.text-center] 57 | .Responsive Design - Desktop View 58 | image::4_3.png[Responsive Design - Desktop View] 59 | 60 | Our webpage will look like this regardless of the size without any media queries. 61 | However, let's change the code in the ` 74 | ---- 75 | 76 | [#img-4_4] 77 | [.text-center] 78 | .Responsive Design Under 500px 79 | image::4_4.png[Responsive Design Under 500px] 80 | 81 | The image above shows what the webpage will look like given this style. 82 | What this does is set a style on screens with a maximum width of `500px`. 83 | If it is more than `500px`, `.responsive-class' will have a `background-color: yellow;`. 84 | This is the premise of responsive design: you will set media queries for all your classes and ids so they know how to behave on different screen sizes. 85 | You could put any styles in the media query and also change the `max-width` property to `max-height`, `min-width` and `min-height`. 86 | There are many other ways to set media queries, and there are plenty of resources that list these ways out. 87 | Thanks to many different tools on the internet, responsive design can be done much more efficiently than constantly making media queries. 88 | Bootstrap, for example, is a library that does much of this for you. 89 | We will jump into it now. 90 | 91 | === Bootstrap 92 | Bootstrap is a front end framework/library that allows you to easily create mobile-friendly websites. 93 | Not only is it great for mobile websites, but it has a lot of handy helper features that make styling very easy. 94 | Bootstrap makes it very easy to get it in your webpage. 95 | In your ``, simply add the following link: 96 | 97 | ---- 98 | 99 | ---- 100 | Then, at the end of your ``, add the following: 101 | 102 | ---- 103 | 104 | 105 | 106 | ---- 107 | 108 | This is all you need to get Bootstrap started. 109 | Bootstrap is just a stylesheet and Javascript scripts that you can use. 110 | For future reference, you can get your Bootstrap links https://getbootstrap.com/docs/4.3/getting-started/download/#bootstrapcdn[here]. 111 | 112 | One of Bootstrap's main features is its grid system. 113 | The grid system organizes the HTML in a way that will change the layout when it goes to certain screen sizes. 114 | As we are going through this chapter, try adjusting the size of your screen to different heights and widths to understand how the style changes. 115 | 116 | ==== Grid 117 | Bootstrap first starts by using containers. 118 | Containers are used to help organize your html when you are organizing it. 119 | Within containers, you have rows and columns that you organize your code in. 120 | 121 | ===== Containers 122 | Bootstrap has two types of containers - `container` and `container-fluid`. 123 | A `container` will have a width that is responsive to the size of the screen and will not take up the entire width. 124 | A `container-fluid` element, on the other hand, will have a width of 100% - meaning it will take up the entire width of its parent element. 125 | These are classes that are assigned to html elements. 126 | So, to implement them, you would use the following. 127 | 128 | ---- 129 |
        130 | This is my container. 131 |
        132 | 133 |
        134 | This is my container-fluid. 135 |
        136 | ---- 137 | 138 | [#img-4_5] 139 | [.text-center] 140 | .Containers 141 | image::4_5.png[Containers] 142 | 143 | As you can see, the `container` will not have the same width as `container-fluid`. 144 | The `container` class will change its width depending on the size of the screen, whereas `container-fluid` will always have `width: 100%`. 145 | You will typically apply these classes to `
        ` elements. 146 | 147 | ===== Rows 148 | Within a container, you will have multiple rows. 149 | This is how Bootstrap arranges content - rows within a container. 150 | 151 | It is defined as the following: 152 | ---- 153 |
        154 |
        155 | CONTENT GOES HERE 156 |
        157 |
        158 | ---- 159 | 160 | ===== Columns 161 | Bootstrap's columns is where the magic really happens. 162 | Within each row, there are twelve potential columns. 163 | However, there can be anywhere between 1-12 columns per row. 164 | It is segmented by 1, and you will want the class of your columns to add up to 12. 165 | This does not mean a lot without looking at it more. 166 | 167 | Let's say we have content that we want to be split into two columns of equal width on a page. 168 | We can simply will type the following: 169 | 170 | ---- 171 |
        172 |
        173 |
        174 | This is "col-6" 175 |
        176 |
        177 | This is the second "col-6" 178 |
        179 |
        180 |
        181 | ---- 182 | 183 | Which will result in the following: 184 | 185 | [#img-4_6] 186 | [.text-center] 187 | .Columns 188 | image::4_6.png[Columns] 189 | 190 | The two columns will take up 6 of the 12 sections that Bootstrap divides rows up into. 191 | That means that each column will take up half of the screen. 192 | We could also do the following: 193 | 194 | ---- 195 |
        196 |
        197 |
        198 | This is "col-4" 199 |
        200 |
        201 | This is the second "col-4" 202 |
        203 |
        204 | This is the third "col-4" 205 |
        206 |
        207 |
        208 | ---- 209 | 210 | This would look like this: 211 | 212 | [#img-4_7] 213 | [.text-center] 214 | .Three Columns 215 | image::4_7.png[Three Columns] 216 | 217 | Each of these columns will take up one third of the page. 218 | This makes it easy for responsive pages, as the actual width of the columns will change based on the size of the screen. 219 | 220 | However, Bootstrap makes it even better. 221 | What if our screen gets too skinny? 222 | Our columns will get very squished and we would potentially see one word per line per column, like the following: 223 | 224 | [#img-4_8] 225 | [.text-center] 226 | .Skinny Screen 227 | image::4_8.png[Skinny Screen] 228 | 229 | Bootstrap sets up media queries to take care of this. 230 | They have set four different screen sizes: `xs`, `sm`, `md`, and `lg`. 231 | These screen sizes correspond to different breakpoints. 232 | 233 | .Summary of Bootstrap Breakpoints 234 | |=== 235 | |Label |Breakpoint 236 | 237 | |`sm` 238 | |Greater than or equal to `576px` 239 | 240 | |`md` 241 | |Greater than or equal to `768px` 242 | 243 | |`lg` 244 | |Greater than or equal to `992px` 245 | 246 | |`xl` 247 | |Greater than `1200px` 248 | 249 | |=== 250 | 251 | So, the way these work is to implement them in the `col-` classes. 252 | The syntax would be `col-[breakpoint]-[number]`. 253 | Let's jump right into an example. 254 | 255 | ---- 256 |
        257 |
        258 |
        259 | This is "col-sm-3" 260 |
        261 |
        262 | This is the second "col-sm-3" 263 |
        264 |
        265 | This is the third "col-sm-3" 266 |
        267 |
        268 | This is the fourth "col-sm-3" 269 |
        270 |
        271 |
        272 | ---- 273 | 274 | This will create breakpoints at 576 pixels. 275 | What the html classes are saying is that when the width of screen is at 576 pixels or more, the columns will stay next to each other. 276 | However once it goes below, the content will stack on top of each other. 277 | 278 | [#img-4_9] 279 | [.text-center] 280 | .Over 576px on left, under 576px on right 281 | image::4_9.png[Over 576px on left, under 576px on right] 282 | 283 | You can do the same with the `md`, `lg`, and `xl` with a variety of columns. 284 | We can also apply multiple breakpoints. 285 | Let's say we have four `col-3` in a row. 286 | When we get to a certain point, we want two rows of `col-6` and when it gets smaller, then we want it to be four rows. 287 | This will be done using the following code: 288 | 289 | 290 | ---- 291 |
        292 |
        293 |
        294 | This is "col-sm-3" 295 |
        296 |
        297 | This is the second "col-sm-3" 298 |
        299 |
        300 | This is the third "col-sm-3" 301 |
        302 |
        303 | This is the fourth "col-sm-3" 304 |
        305 |
        306 |
        307 | ---- 308 | 309 | It tells the columns how to behave in different breakpoints. 310 | So, first it will abide by the `col-md-3` behavior, then it will abide by the `col-sm-6` behavior. 311 | Our webpage will look like the following: 312 | 313 | Before it hits `md`: 314 | [#img-4_10] 315 | [.text-center] 316 | .Greater than `768px` 317 | image::4_10.png[Greater than `768px`] 318 | 319 | Before it hits `sm`: 320 | [#img-4_11] 321 | [.text-center] 322 | .Greater than `576px` 323 | image::4_11.png[Greater than `576px`] 324 | 325 | Before it goes below `sm`: 326 | [#img-4_12] 327 | [.text-center] 328 | .Less than `576px` 329 | image::4_12.png[Less than `576px`] 330 | 331 | Now that we have learned how the Bootstrap grid works, let's look at some other Bootstrap features. 332 | 333 | ==== Other Features 334 | Bootstrap is great for responsive design for the entire layout of the page. 335 | It also has a few other utilities that make it useful. 336 | 337 | ===== Navbar 338 | The Bootstrap Navbar is one of the best features, in my opinion. 339 | It creates a navigation bar that collapses when it gets to a certain breakpoint. 340 | So, it will look like a normal navigation bar at the top of the screen until it hits a certain point. 341 | Then, it will collapse the actual navigation links and show a button that you can click to reveal the navigation links. 342 | Bootstrap has great documentation, so whenever I need a component, such as a navbar, I will start off with the code they have in an example, and then change it accordingly. 343 | Using the https://getbootstrap.com/docs/4.3/components/navbar/[Navbar from Bootstrap's documentation], we can start with the following code. 344 | 345 | ---- 346 | 362 | ---- 363 | 364 | In a screen that is `992px` and larger, it will look like this: 365 | 366 | [#img-4_13] 367 | [.text-center] 368 | .Greater than or equal to `992px` 369 | image::4_13.png[Greater than or equal to `992px`] 370 | 371 | And smaller screens, such as mobile, will look like this: 372 | 373 | [#img-4_14] 374 | [.text-center] 375 | .Less than `992px` 376 | image::4_14.png[Less than `992px`] 377 | 378 | 379 | Their default Navbar in the first example code is much more complex, with many different item types. 380 | However, let's start with the previous code. 381 | 382 | We first have our entire `