Posted in how to
3901
1:22 am, January 21, 2020
 

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

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

This post follows on from my previous one How to do a simple landing page from scratch, where I detailed how to create the basic elements of a landing page.

This Howto or Tutorial on how to do a landing page using bootstrap simplifies the landing page even more, by using the popular bootstrap framework.

What do we want on our landing page?

For this tutorial we will be focusing on 5 main elements.

  • Header

  • Hero Image

  • Hero Text

  • Three boxes, with icons and call to action buttons

  • Footer

HTML Page Setup

Here we will be setting up the basics for our landing page, we will just be creating a flat html file and link to external css to get the nice styles happening.

Lets create a directory where we will save the main landing page file. I like to save things to google drive, so that I can access them on all my devices, but you can just save locally to your PC if you prefer.

Now lets add an index.html file, we call it index as most webservers will be setup to view the index.html or htm file first, so if you browse to that directory it will show that file rather than listing the directory contents.

Usually to add the file in windows you can just add a text file and then rename it to html, but you can also do this through an editor if you prefer.

Now to edit this file you can just use notepad, but it’s pretty ugly and makes editing the code a non-pleasant experience. So you can download one of my favourite code editors, Sublime Text, or Atom.io. I have been using Atom for a while now, it has some great plugins, but sublime is still a good goto text editor which is great and simple for editing local files.

Download Atom.io Here: https://atom.io/

Download Sublime Text Here: https://www.sublimetext.com/

Ok once you have picked your editor, load the index.html file into it.

Using sublime you can just type html and press tab to auto fill a very basic html template.

Now we can link to the bootstrap cdn files to add the bootstrap framework.

I usually use the cdnjs cdn to link these as they host most of the frameworks and javascript.

Link to cdnjs version of bootstrap: https://cdnjs.com/libraries/twitter-bootstrap

Now we need to copy the CDN Links for the min versions of bootstrap. Using the min versions of this will increase page load times as they are minified, and we won’t need to modify them anyway so may as well save file load size.

Here are the links that we need to copy and add to the header. Find the files and mouse over to the right of them and you get this menu where you can copy the full stylesheet or js import tag. Paste these into your header.

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/js/bootstrap.min.js

Now lets paste them in below the title here:

With the javascript we usually add these just before the end body tag, like this:

Now we can save this file and we have the bare bones file ready to add our bootstrap template elements.

At this stage all our landing page has is “body content here…” or whatever page text you added. But this is the basis for a boot strap landing page. You can test it out by dragging the file into your browser window, and it should show something like this.

We will be adding some more exciting elements to the page in Part 2.

This is the end of part one to this post How to do a simple bootstrap landing page from Scratch, in Part 2 we will be adding some elements to the page so it looks a bit more interesting than just the text. body content here…

Download

You can download this article as a PDF here. Click to Download as PDF

Part 2

Yay part two is done! Check it out here...

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

View Statistics
This Week
96
This Month
461
This Year
641

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 here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
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
Random CSS Property

:where()

The :where() CSS pseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list.
:where css reference