Skip to content

Instantly share code, notes, and snippets.

@Camvillard
Last active October 1, 2019 21:09
Show Gist options
  • Save Camvillard/eff0ee838aa45f9538521d26c3aa2460 to your computer and use it in GitHub Desktop.
Save Camvillard/eff0ee838aa45f9538521d26c3aa2460 to your computer and use it in GitHub Desktop.
Le Wagon workshop - Intro to HTML & CSS

Le Wagon workshop - Intro to HTML & CSS

What you will build in this workshop: your responsive landing page

1. LET'S SET UP

  1. Start Sublime Text. It will open a new black window.
  2. Create a folder landing on your Desktop. Drag & drop this folder in the Sublime Text window.
  3. In Sublime Text left navigation:
    • Right click "New file"
    • Save it as index.html with Cmd + S or Ctrl + S
    • Do the same to create a style.css file
    • Then "New Folder" and create an images folder
  4. Finally double click on index.html to open it with Chrome

img

2. ADD SOME HTML CONTENT

  • To save time, just right-click on the following images and save them in your images folder, renaming them as suggested below:

    fast.png img trustable.png img affordable.png img

  • Then start with this HTML code in index.html

<html>
  <head>
    <meta charset="utf-8">
    <title>My Product</title>
  </head>
  <body>
    <h1>My Product</h1>
    <p>Here you describe your value proposition...</p>
    <p>
      <a href="#">Start now</a>
    </p>

    <img src="images/fast.png" alt="picture description" width="140">
    <h2>Fast</h2>
    <p>We deliver fast, <strong>very fast</strong></p>

    <img src="images/trustable.png" alt="picture description" width="140">
    <h2>Trustable</h2>
    <p>You can trust us, <strong>like really</strong>.</p>

    <img src="images/affordable.png" alt="picture description" width="140">
    <h2>Affordable</h2>
    <p>We adapt our price to <strong>your situation</strong>.</p>

    <p>This is a website made ©Le Wagon</p>
  </body>
</html>

Extra - find nice personal icons

3. CSS FOR FONTS & COLORS

Link your stylesheet style.css in the head section of your HTML

<head>
  <link href='style.css' rel='stylesheet'>
</head>

Then copy/paste the CSS code below in style.css and fix it cause it's ugly

/*  Fonts and colors */
body {
  background: rgb(240,240,240);
  color: rgb(30,30,30);
  font-size: 18;
  font-family: Lato, sans-serif;
  margin: 0px;
  font-weight: lighter;
}

h1 {
  font-weight: bold;   
}

h2 {
  font-weight: bold;
  font-size: 24px;
  color: #6A71E1;
}

a {
  color: #6A71E1;
  text-decoration: none;
}

a:hover {
  color: black;
}

4. WRAP WITH DIV

Wrap different sections in different div

<div>
  <h1>My product</h1>
  <p>Here you describe your value proposition...</p>
</div>

<div>
    <img src="images/fast.png" alt="picture description" width="140">
    <h2>Fast</h2>
    <p>We deliver fast, <strong>very fast</strong></p>
</div>

<div>
    <img src="images/trustable.png" alt="picture description" width="140">
    <h2>Trustable</h2>
    <p>You can trust us, <strong>like really</strong>.</p>
</div>

<div>
    <img src="images/affordable.png" alt="picture description" width="140">
    <h2>Affordable</h2>
    <p>We adapt our price to <strong>your situation</strong>.</p>
</div>

<div>
  <p>This is a website made ©Le Wagon</p>
</div>

5. NAME YOUR TAGS

  • Name your banner, features and footer with class like <div class="banner">, <div class="card-white"> and <div class="footer">
  • Name your main container with id like <div id="features">
  • Then add this nice CSS code
/* Custom design with classes */
.banner {
  text-align: center;
  color: white;
  padding: 150px 0px;
  background-image: linear-gradient(-225deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%), url("https://picsum.photos/1000/600?random");
  background-size: cover;
  background-position: center;
}
.banner h1 {
  font-size: 50px;
}
.banner p {
  opacity: 0.8;
  font-size: 30px;
  font-weight: lighter;
  margin-bottom: 40px;
}

.btn-blue {
  color: white;
  background: #6772e5;
  box-shadow: 0 4px 6px rgba(50,50,93,.11);
  border-radius: 4px;
  padding: 15px 20px;
}
.btn-blue:hover {
  background: #7795f8;
  color: white;
}

.card-white {
  background-color: white;
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(50,50,93,.11);
  padding: 16px;
  margin: 16px 0px;
}

.card-white img {
  margin-bottom: 20px;
}

.footer {
  background-color: black;
  padding: 24px;
  color: white;
}

/* Adjustments with id */
#features {
  padding: 64px 0px;
}

Extra - find a cool background image

  • You can pick your background picture on Pexels

6. FONTAWESOME

First, you will have to create a fontawesome kit. Go to Font Awesome. Enter your email and confirm. Go to your mailbox to confirm your email address and finish the setup in Font Awesome. Once you fill in the form, they will provide a kit code. Copy the kit code and paste it in your head!

It should look like this:

<head>
  <script src="https://kit.fontawesome.com/010f2c19e5.js"></script>
</head>

And then in the footer

<ul>
  <li><a href="#"><i class="fab fa-youtube"></i></a></li>
  <li><a href="#"><i class="fab fa-facebook"></i></a></li>
  <li><a href="#"><i class="fab fa-twitter"></i></a></li>
  <li><a href="#"><i class="fab fa-github"></i></a></li>
</ul>

With a bit of CSS style

.footer a {
  color: white;
  font-size: 32px;
}

.list-inline {
  list-style: none;
  padding-left: 0px;
}
.list-inline li {
  display: inline;
  padding: 0px 8px;
}

7. BOOTSTRAP SETUP

Link Bootstrap stylesheet in the head section of your HTML before your stylesheet link

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  <link href='style.css' rel='stylesheet'>
</head>

Play with class="btn btn-primary" your first Bootstrap classes

8. BOOTSTRAP GRID

  • Inject your 3 cards div in the following responsive grid
<div class="container">
  <div class="row">
    <div class="col-xs-12 col-sm-6 col-lg-4">
      <!-- div class="card" -->
    </div>
    <div class="col-xs-12 col-sm-6 col-lg-4">
      <!-- div class="card" -->
    </div>
    <div class="col-xs-12 col-sm-6 col-lg-4">
      <!-- div class="card" -->
    </div>
  </div>
</div>

9. PUBLISH YOUR WEBSITE

⚠️ The following tutorial is for publishing a website called <code>my-profile</code>. You can follow exactly the same process to publish you project called <code>landing</code>.⚠️

1. Install Gihub Desktop application

To put your website online, you need first to:

  1. Create an account on Github.
  2. Install Github Desktop App to communicate with your Github account.

Once it’s done, you are ready to publish your website following this tutorial.

2. Create the repository

First, open Github desktop application and drag and drop you project inside

screen shot 2018-08-27 at 10 50 28

Then, click on the create a repository link and then on the Create Repositorybutton of the modal:

screen shot 2018-08-27 at 10 50 28

3. Publish it on Github

Well done! Now that the repository has been created on your computer, we need to put it on Github. Very easy, just click on Publish repository in the menu.

screen shot 2018-08-27 at 10 50 28

Your project my-profile should be on your Github profile after this step. Check that you can find it in your Github repositories.

screen shot 2018-08-27 at 10 50 28

4. Activate the “magic” setting ✨

Time to activate a Github setting that will automatically put you website online ✨✨✨. For that go to the project setting on Github.

screen shot 2018-08-27 at 10 50 28

Scroll to the Github Pages section of the settings and Save the master branch.

screen shot 2018-08-27 at 10 50 28

That’s all you need to know, normally Github will generate the automatic URL of your website and give it to you in the same section. You just have to wait a few minutes and you should see your profile page live on this URL 😎😎😎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment