Posted in how to
6
2:49 am, January 28, 2020

How to do a simple bootstrap landing page from Scratch - Part 3

Ok in out previous Part 1 and Part 2 of How to do a simple bootstrap landing page from Scratch, we have so far added a base file, bootstrap, jquery, top nav, hero image and hero text.

Time to add some boxes to this landing page. Every landing page needs three boxes, doesn’t it? Well apparently this one does, so lets add them.

Let’s add some boxes.

Bootstrap will do all the heavy lifting for box styles using the card class and the bootstrap grid to align them in a row.

Add a container

This acts like a wrap, making sure that the content does not go all the way to the edge of the screen so will keep our three boxes in the middle of the screen rather than going all over the place.

Then we will add the columns.

They will all be the same size so bootstrap will figure out the widths.

Let’s have a look and make sure it’s all looking ok so far.

Looking ok so far, now to add the actual boxes, into the grid.

We can use the bootstrap card for this to give it a bit of a border and title.

Reload it again and see what the cards look like.

Yep cards look ok, just need to add some margin to the top there, or at the bottom of the hero image, to pad it out a bit.

Save and reload again to see if it looks good.

Yep looking better.

Now we need to add an action button to each card, and center the text.

Let’s add a class to cover all of our promo cards to easily center the text.

Add a style selector for this as well to the styles.

Looking a bit neater now.

Now to add some icons, we will use font awesome for this as they are fairly easy to add and have a ton of icons.

Installing Font Awesome

Once again to install font awesome we just need to head over to cdnjs and type in font awesome.

Then copy the link and paste into the header of our landing page. As its a css we should add this to the header. Copy the Link Tag and paste it under the existing bootstrap css.

Now the font awesome library is available, you can browse the icons available here. https://fontawesome.com/icons?d=gallery

Let’s pick some icons for our cards.

Click on the icon (on the font awesome website) and, up the top of the page there is a Copy HTML link.

Just click on that top copy the code to your clipboard.

Just make a small change to the card and change the title to a h5 tag, so that the card has a nicer title.

Then underneath this we can past the icon.

Now to paste in the icon code.

Reload the landing page and see how it looks.

Not too bad, but the icon is a bit small. Add a class to the icon to make it larger, font awesome comes with built in classes to do this. Fa-2x, 3x, 4x, etc. Or you can change it with css, but we may as well just use the built in class. Try 4x and see what it looks like. Fa-4x

Now i think the icon looks a bit strange under the title so we will swap them, and make the icon a bit lighter in colour.

Change the class on the icon wrap, from card-text to card-icon and then add a css style for it.

Reload the landing page, and have a look.

Yep looks like a box.

As this is already a couple of pages long, ill end part 3 here. Not sure how many parts this will end up as, hopefully not too many. Will see at the end!

Files

You can look at my files so far here, if you want to see what it looks like, or just cheat and copy it! :)

Demo

I have uploaded a demo of the files so far, so you can see what it looks mid progress / or so far. Check out the demo so far here.

View Statistics
This Week
50
This Month
193
This Year
0

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Articles
Search Articles by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

Join me on Substack if you want me to send you a collection of the things i have done or found or read for the week. Or follow me on twitter if you prefer, i dont post much but i probably should!

❤👩‍💻🕹

Random Quote

"Olivia, my eldest daughter, caught measles when she was seven years old. As the illness took its usual course I can remember reading to her often in bed and not feeling particularly alarmed about it. Then one morning, when she was well on the road to recovery, I was sitting on her bed showing her how to fashion little animals out of coloured pipe-cleaners, and when it came to her turn to make one herself, I noticed that her fingers and her mind were not working together and she couldn’t do anything. 'Are you feeling all right?' I asked her. 'I feel all sleepy,' she said. In an hour, she was unconscious. In twelve hours she was dead. The measles had turned into a terrible thing called measles encephalitis and there was nothing the doctors could do to save her. That was...in 1962, but even now, if a child with measles happens to develop the same deadly reaction from measles as Olivia did, there would still be nothing the doctors could do to help her. On the other hand, there is today something that parents can do to make sure that this sort of tragedy does not happen to a child of theirs. They can insist that their child is immunised against measles. ...I dedicated two of my books to Olivia, the first was ‘James and the Giant Peach’. That was when she was still alive. The second was ‘The BFG’, dedicated to her memory after she had died from measles. You will see her name at the beginning of each of these books. And I know how happy she would be if only she could know that her death had helped to save a good deal of illness and death among other children."

I just checked google books for BFG, and the dedication is there. 

https://www.google.com.au/books/edition/_/quybcXrFhCIC?hl=en&gbpv=1 


Roald Dahl, 1986