Table of Contents for
Practical Web Design

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Practical Web Design by Philippe Hong Published by Packt Publishing, 2018
  1. Practical Web Design
  2. Title Page
  3. Copyright and Credits
  4. Practical Web Design
  5. PacktPub.com
  6. Why subscribe?
  7. PacktPub.com
  8. Contributers
  9. About the author
  10. About the reviewers
  11. Packt is searching for authors like you
  12. Table of Contents
  13. Preface
  14. Who this book is for
  15. What this book covers
  16. To get the most out of this book
  17. Download the example code files
  18. Download the color images
  19. Conventions used
  20. Get in touch
  21. Reviews
  22. Evolution of Web Design
  23. The first ever website
  24. Table-based layouts
  25. Introduction of Flash
  26. CSS – the savior
  27. Web 2.0
  28. The rise of the mobile
  29. Responsive web design
  30. Flat design
  31. What's next?
  32. Summary
  33. Web Design and its Components
  34. Grids
  35. The cons
  36. Call to Action
  37. Making it obvious
  38. Using contrasting color
  39. Compelling copy
  40. Placement
  41. Breadcrumb
  42. The search bar
  43. The submit button
  44. Making it noticeable
  45. Placing the search bar correctly
  46. Icons
  47. Describing in a nutshell  
  48. Drawing attention of the users
  49. Directional
  50. Modal
  51. Typography
  52. Choosing a font that connects your brand
  53. Serif fonts
  54. Sans-serif
  55. Casual scripts
  56. Don't use too much typeface
  57. Colors
  58. What colors mean
  59. Usability
  60. Simplicity
  61. Navigability
  62. Accessibility
  63. Consistency
  64. So, how can we be consistent?
  65. Design
  66. Content
  67. Interactions
  68. Summary
  69. Website-Designing Workflow
  70. Our situation
  71. Goal identification
  72. What is the purpose of the website?
  73. Who is the website for?
  74. Is this useful for our audience?
  75. What do they expect to find or do there?
  76. Does the website need to follow a brand or have its own brand identity?
  77. Are there any competitors? If there are, how is the website different than others?
  78. Defining the scope
  79. Creating wireframes
  80. Designing
  81. Get inspiration
  82. Improve
  83. Invent
  84. Implementing, testing, and launching
  85. Summary
  86. Responsive Versus Adaptive Design
  87. Responsive design
  88. Adaptive design
  89. So which one is the best?
  90. The takeaway
  91. Summary
  92. Learning HTML5
  93. Our main tool
  94. What is HTML?
  95. HTML tags
  96. HTML attributes
  97. HTML structure
  98. Creating our first page
  99. HTML elements
  100. Titles and paragraphs
  101. Links and images
  102. Summary
  103. Learning CSS3
  104. The different ways to use CSS
  105. CSS formatting
  106. Parent and child elements
  107. Classes and IDs
  108. CSS box model  
  109. The boxes
  110. Block and inline
  111. CSS layout and dividers
  112. The basic layout
  113. Formatting and indenting your HTML
  114. Styling our class
  115. Summary
  116. Building Your Own Website
  117. Our design
  118. Installing HTML Boilerplate
  119. Editing index.html
  120. Creating our web page
  121. Images folder
  122. Installing our font
  123. Importing Google Font
  124. Adding normalize.css
  125. The header
  126. Creating a menu
  127. Inserting links
  128. Adding a logo
  129. Right-hand side menu
  130. Adding a Facebook like button
  131. Styling our header
  132. Adding the hero section
  133. CSS flexbox
  134. Positioning in CSS
  135. Position static
  136. Position relative
  137. Position absolute
  138. Position fixed
  139. Position sticky
  140. Blog section
  141. Creating the ABOUT US section
  142. Adding the Partner section
  143. Adding the footer section
  144. Summary
  145. Making Our Website Responsive
  146. What are media queries? 
  147. Opening the inspector
  148. Desktop first
  149. Designing the menu
  150. What is jQuery? 
  151. jQuery syntax
  152. Making the hero section responsive
  153. Making the Blog section responsive
  154. Making the ABOUT US section responsive
  155. Making the footer section responsive
  156. Summary
  157. Adding Interaction and Dynamic Content
  158. CSS pseudo-classes
  159. Sticky navigation 
  160. JS Plugin: Waypoints
  161. CSS animation
  162. Adding a dynamic Instagram feed
  163. Installing Instafeed.js
  164. Getting images from your user account
  165. Finding our userID and TokenAccess
  166. Getting our access token
  167. Displaying the feed
  168. Summary
  169. Optimizing and Launching Our Website
  170. Creating a favicon
  171. Site performance optimization
  172. Optimizing images
  173. Optimizing our code
  174. Basic SEO improvement
  175. What is search engine optimization?
  176. Meta description
  177. Valid HTML
  178. Keywords
  179. Links
  180. Launching our website
  181. Buying a domain name
  182. Google analytics
  183. Google Search Console
  184. Summary
  185. What is Bootstrap?
  186. What is Bootstrap?
  187. Components
  188. Bootstrap Grid system
  189. Media queries
  190. Summary
  191. Building a Website with Bootstrap
  192. Installing Bootstrap 
  193. Setting up our project 
  194. Bootstrap navbar 
  195. Coding the Bootstrap navigation
  196. Styling our navigation bar 
  197. Styling the hero section
  198. Styling the Blog section
  199. Styling the about section 
  200. Styling the partner section
  201. Styling the footer
  202. Summary
  203. Introduction to Client-Side Rendering
  204. What is server-side rendering?
  205. What is client-side rendering?
  206. Pros and cons of server and client-side rendering
  207. Server-side rendering
  208. Client-side rendering
  209. Introducing to VueJS
  210. Setting up VueJS
  211. Creating a weather application in VueJS
  212. Vue Material
  213. Components
  214. OpenWeather API
  215. The API call
  216. Summary
  217. Tools to Help Your Workflow
  218. HTML Boilerplate
  219. Lorem Ipsum
  220. CSS preprocessor – LESS
  221. CSS preprocessor – SCSS
  222. ColorZilla
  223. Foundation
  224. Fontastic
  225. webflow
  226. Modernizr
  227. CSS3 Generator
  228. git
  229. CodeKit
  230. Animate.css
  231. TinyPNG
  232. Unsplash
  233. Summary
  234. Other Books You May Enjoy
  235. Leave a review - let other readers know what you think

Blog section

First, as we always do (and you need to get into this habit), we need to analyze the design and see how is it composed:

As we can see, the Blog section is composed of a header and six Blog posts. There are two rows of three posts each, with an equal width of one-third.

We know how to design this with a float and the display: inline-block properties. Let's try to build it with CSS flexbox. 

Let's first add the HTML:

<section id="blog">
<div class="container">
<h2><b>Blog</b> Everything about RACING CLUB</h2>

</div>
</section>

Here are some explanations: 

  1. We need to create another section id "blog"
  2. We need to reuse the class container to have a container that follows the same width
  3. We add an <h2> since it's not as important as the hero title
  4. We add a <b> tag to make the word Blog bold

Let's add our blog posts section now:

<section id="blog">
<div class="container">
<h2><b>Blog</b> Everything about RACING CLUB</h2>
<div class="blog-posts">
<div class="blog-post">
<img src="img/blog-img/blog1.jpg" srcset="img/blog-img/blog1.jpg 1x, img/blog-img/blog1@2x.jpg 2x">
<p class="blog-post-date">09th January 2016</p>
<h3>Racing Club Advan Neova Challenge Round 3 Update</h3>
<p class="blog-post-desc">FINAL ROUND: Labour Day Trackday Wakefield Park. Last chance to compete in the Circuit Club Advan Neova Challenge 2016!
There was much anticipation with Jason's big power Evo competing at Round 3, however some suspected engi… <a href="#">Read More</a></p>
</div>
</div>
</div>
</section>

Here is what we did: 

  1. We added a div with the class "blog-posts" that contains all the Blog posts.
  1. Inside, we create a div with the class "blog-post", which will be a single blog post.
  2. Inside this div, we added the image with the img tag and srcset we learned earlier.
  3. We also added a p tag with a class "blog-post-date" for the Blog post date.
  4. We added a <h3> without class because it's the only h3 element, so we can target it easily with CSS.
  5. Lastly, we added the description text with a link inside.

This represents a single Blog post, so to make six of them, we simply need to duplicate the blog post element six times.

Let's also add another div to make our Show More button:

<div class="blog-show-more">
<button type="button" name="button" class="btn-primary">More posts</button>
</div>

In the end, you should have something like this:

<section id="blog">
<div class="container">
<h2><b>Blog</b> Everything about RACING CLUB</h2>
<div class="blog-posts">

<div class="blog-post">
<img src="img/blog-img/blog1.jpg" srcset="img/blog-img/blog1.jpg 1x, img/blog-img/blog1@2x.jpg 2x">
<p class="blog-post-date">09th January 2016</p>
<h3>Racing Club Advan Neova Challenge Round 3 Update</h3>
<p class="blog-post-desc">FINAL ROUND: Labour Day Trackday Wakefield Park. Last chance to compete in the Circuit Club Advan Neova Challenge 2016!
There was much anticipation with Jason's big power Evo competing at Round 3, however some suspected engi… <a href="#">Read More</a></p>
</div>

<div class="blog-post">
<img src="img/blog-img/blog2.jpg" srcset="img/blog-img/blog2.jpg 1x, img/blog-img/blog2@2x.jpg 2x">
<p class="blog-post-date">09th January 2016</p>
<h3>Hidden Behind the Scenes</h3>
<p class="blog-post-desc">Originally posted by Narada Kudinar, 23.08.11.
At our Trackdays, we get a variety - owners with their girlfriends, owners with their mates, owners and their mechanics - but there is one combination I am truly at envy with. It's the owners and their Dads. <a href="#">Read More</a></p>
</div>

<div class="blog-post">
<img src="img/blog-img/blog3.jpg" srcset="img/blog-img/blog3.jpg 1x, img/blog-img/blog3@2x.jpg 2x">
<p class="blog-post-date">04th July 2015</p>
<h3>Introducing Advan Trackdays!</h3>
<p class="blog-post-desc">For the first time, Yokohama Advan Tyres are hosting their very own Trackdays, hosted by your's truly! The aim? To thank their loyal customers by providing a bargain event as well as introduce new Advan tyres to those who don't use them yet...<a href="#">Read More</a></p>
</div>

<div class="blog-post">
<img src="img/blog-img/blog4.jpg" srcset="img/blog-img/blog4.jpg 1x, img/blog-img/blog4@2x.jpg 2x">
<p class="blog-post-date">09th Jun 2015</p>
<h3>ANZAC Day Spots Running Out!</h3>
<p class="blog-post-desc">FINAL ROUND: Labour Day Trackday Wakefield Park. Last chance to compete in the Circuit Club Advan Neova Challenge 2016!
There was much anticipation with Jason's big power Evo competing at Round 3, however some suspected engi… <a href="#">Read More</a></p>
</div>

<div class="blog-post">
<img src="img/blog-img/blog5.jpg" srcset="img/blog-img/blog5.jpg 1x, img/blog-img/blog5@2x.jpg 2x">
<p class="blog-post-date">15th Mar 2015</p>
<h3>10 Year Anniversary Details Now Available!</h3>
<p class="blog-post-desc">Originally posted by Narada Kudinar, 23.08.11.
At our Trackdays, we get a variety - owners with their girlfriends, owners with their mates, owners and their mechanics - but there is one combination I am truly at envy with. It's the owners and their Dads. <a href="#">Read More</a></p>
</div>

<div class="blog-post">
<img src="img/blog-img/blog6.jpg" srcset="img/blog-img/blog6.jpg 1x, img/blog-img/blog6@2x.jpg 2x">
<p class="blog-post-date">16th Jan 2015</p>
<h3>Prepare for EPICNESS</h3>
<p class="blog-post-desc">For the first time, Yokohama Advan Tyres are hosting their very own Trackdays, hosted by your's truly! The aim? To thank their loyal customers by providing a bargain event as well as introduce new Advan tyres to those who don't use them yet... <a href="#">Read More</a></p>
</div>

</div>
div class="blog-show-more">
<button type="button" name="button" class="btn-primary">More posts</button>
</div>

</div>
</section>

Let's head to the CSS now! We will style the title first:

#blog h2 {
font-family: 'built_titling', Helvetica, sans-serif;
font-weight: 200;
font-size: 60px;
}

For the blog-posts container, we'll do as follows:

.blog-posts {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 50px;
}

.blog-post {
width: 33.33%;
padding: 0 5px;
box-sizing: border-box;
margin-bottom: 30px;
}

.blog-posts is the parent element and .blog-post is the child element.

Here is some information regarding .blog-posts:

  1. display: flex; always needs to be added to the parent element.
  2. flex-direction: row; will direct the child elements as a row. You can put it as a column if you want.
  1. flex-wrap: wrap; will make the child elements wrap onto multiple lines, from top to bottom. By default, it will try to fit every element on to one line.
  2. margin-top: 50px; adds a bit of margin on the top.

Here is some information regarding .blog-post:

  1. width: 33.33%; sets the width as one-third of the total width
  2. padding: 0 5px; adds some padding on the right and left sides
  3. box-sizing: border-box;: as we saw earlier, this makes the padding and margin properties apply inside the box instead of outside

So far, we have the right layout: 

Let's style the content inside a Blog post:

.blog-post img {
width: 100%;
}

We use width: 100%; as we want our images to take 100% of the width. The rest is pretty basic CSS, just to follow the design:

.blog-post .blog-post-date {
font-size: 14px;
color: #9A9A9A;
margin-top: 20px;
}

.blog-post h3 {
font-size: 20px;
color: #4A4A4A;
letter-spacing: -0.4px;
line-height: 1.4;
}


.blog-post .blog-post-desc {
font-size: 14px;
color: #4A4A4A;
line-height: 1.6;
}

.blog-post .blog-post-desc a {
color: #BF0000;
text-decoration: underline;
font-weight: bold;
}

Here's what we end up with:

It's looking quite similar to me now. The last part is the Show More button. A simple hack would be to add a text-align: center to the parent element so it will make the button aligned in the middle:

.blog-show-more {
text-align: center;
}

For the last touch, I'll add some margins at the bottom to add a bit of white space:

#blog {
margin-bottom: 50px;
}

Our CSS for the blog section:

/* BLOG SECTION */

#blog {
margin-bottom: 50px;
}

#blog h2 {
font-family: 'built_titling', Helvetica, sans-serif;
font-weight: 200;
font-size: 60px;
}

.blog-posts {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 50px;
}

.blog-post {
width: 33.33%;
padding: 0 5px;
box-sizing: border-box;
margin-bottom: 30px;
}

.blog-post img {
width: 100%;
}

.blog-post .blog-post-date {
font-size: 14px;
color: #9A9A9A;
margin-top: 20px;
}

.blog-post h3 {
font-size: 20px;
color: #4A4A4A;
letter-spacing: -0.4px;
line-height: 1.4;
}

.blog-post .blog-post-desc {
font-size: 14px;
color: #4A4A4A;
line-height: 1.6;
}

.blog-post .blog-post-desc a {
color: #BF0000;
text-decoration: underline;
font-weight: bold;
}

.blog-show-more {
text-align: center;
}


/* END OF BLOG SECTION */