Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

HTML & CSS IntroductionChapter 19. Publishing Websites

GitHub Pages

GitHub Pages

Leveraging GitHub Pages for Website Hosting

GitHub Pages is a website hosting service provided by GitHub. GitHub Pages is connected with GitHub repositories. You can publish website documents stored in a GitHub repository very easily.

Publish a website using GitHub Pages

Having basic knowledge about Git and GitHub is preferable, but even if you don't know how to use Git and GitHub, you can use GitHub Pages.

Here are the key steps to publish a website using GitHub Pages.

  1. Create a GitHub account
  2. Create a new repository
  3. Upload project files
  4. Commit the change
  5. Setup a branch for GitHub Pages
  6. Check the website in a browser

We'll explain each step in the practice section below.

Practice

Objective:
Publish a website using GitHub Pages

1. Create your GitHub account

  • Go to the GitHub website.
  • Click on the Sign up button.
GitHub Pages setup: Step 1
  • Register your email, password, and username.
  • Select a free plan.

2. Create a new repository

  • Click the green New button or select New Repository from the + menu.
GitHub Pages setup: Step 2a
  • Type a repository name. In this practice, we set html-css-introduction.
  • Click on the Create repository button.
GitHub Pages setup: Step 2b

3. Upload project files

  • If you know how to use Git and GitHub, you can push the project files to the repository. If you don't know how to do that, you can use the file uploader prepared by GitHub.
  • To upload project files using the file uploader, click uploading an existing file like shown in the image below.
GitHub Pages setup: Step 3a
  • You'll go to the file uploader page.
GitHub Pages setup: Step 3b
  • In the project directory, select all the project files (not the project directory itself).
  • Drag the files and drop them into the file uploader section.
GitHub Pages setup: Step 3c

4. Commit the change

  • To save the files in the repository, you need to make a commit. Type a commit message like "Added files via upload". You can also skip typing the message. In that case, the message will auto-generated.
  • Click on the Commit changes button.
GitHub Pages setup: Step 4a
  • Now you can see that the files are successfully uploaded into the repository.
GitHub Pages setup: Step 4b

5. Setup a branch for GitHub Pages

  • To activate GitHub Pages, you need to set up a branch.
  • As the default branch setting is none, you need to change it to the main branch.
GitHub Pages setup: Step 5a
  • After selecting the main branch, click on the Save button.
  • It may take time in this process.
GitHub Pages setup: Step 5b

6. Check the website in a browser

Websites hosted in GitHub Pages are available at the following URL

https://username.github.io/repository name/

For a username, use your GitHub account name. For the repository name, use html-css-introduction set in this practice.

You'll see that your website was successfully published.

GitHub Pages setup: Step 6

You can also check the sample result here (Demo Site).

link

IdeaGitHub Pages Account URL

If you don't want to use an additional path after username.github.io/ in the URL of your website, you need to set username.github.io as a repository name.

For example, when the username of the GitHub account is sky-blue2022, create a repository using sky-blue2022.github.io as the repository name. The website will be accessible at https://sky-blue2022.github.io/.

Updating a website using GitHub Pages

There are three ways to update a published website. It may usually take a few minutes for the website to be updated.

Option 1. Directly edit the GitHub repository

  • Open the file you want to edit in the GitHub repository. Select the edit icon to edit.
  • After editing the file, press the green Commit changes... button.
Updating a website using GitHub Pages: directly edit on the GitHub website

Option 2. Re-upload the edited documents using the uploader

  • The way to upload new documents is the same as the one we already explained.
  • When you upload the file with the same name in the repository, the existing file will be replaced with the new file.

Option 3. Connect the GitHub remote repository with your local Git repository

  • This is the most common approach; however, you need to understand the basics of Git and GitHub. Check the Git & GitHub Introduction course if you want to understand how to use Git and GitHub.

IdeaEntry file for GitHub Pages

When you use GitHub Pages, you need to have an index.html file in the project directory used as the entry file. GitHub Pages will look for the index.html file when users access the URL of your website using GitHub Pages. The file name is case-sensitive. You cannot use Index.html as the entry file name.

The entry file must be placed at the top level of the repository so that GitHub Pages can properly access it.


You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Styles in Figma

Styles in Figma

How to Enhance Forms with Labels

Labels

Maximizing Layout Flexibility with flex-grow

flex-grow

Navigating the Main Axis and Cross Axis in Flex Box

Main Axis and Cross Axis

Styles in Figma

Styles in Figma

How to Enhance Forms with Labels

Labels

Maximizing Layout Flexibility with flex-grow

flex-grow

Navigating the Main Axis and Cross Axis in Flex Box

Main Axis and Cross Axis

Tags:

GitHub Pages

Web Hosting

HTML & CSS Introduction
Course Content

Chapter 1. Overview of Website Development

How Websites Work?

Designing, Building and Publishing Websites

Designing Websites

Building Websites – Frontend and Backend Coding

Web App vs. Website

Frontend Coding

Web Framework and CMS

Publishing Websites (Hosting Services)

Chapter 2. Preparing for Website Coding

Two Key Tools to Start Coding Websites

How Browsers Display Web Pages

File Name Rules

Website Directory Structure

Absolute Path vs. Relative Path

Chapter 3. HTML Basics

What Is HTML?

HTML Element

Attribute

HTML Document Structure

Layout Semantics

Heading and Paragraph Tag

Text-Level Semantics

Space, Line-break and Tag in Content

Comments in HTML Document

Chapter 4. HTML: Add Links and Images

Overview of Adding Links and Images

Embed Images – <img>

Image File Format

Add Hyperlinks – <a>

Add Hyperlinks to Images

Add Hyperlinks to Specific Location on Web Page

Link Tag – <link>

Script Tag – <script>

Chapter 5. HTML: Create Lists and Tables

Create Lists

Create Tables

Combine Table Cells

Chapter 6. HTML: Create Forms

Create Forms

Create Text Input Forms and Submit Button

Radio Button and Checkbox

Select Box

Labels

Auto Complete and Disabled

Chapter 7. Bridging HTML and CSS

Block Element vs. Inline Element

Nesting Elements – Parent Elements and Child Elements

Div vs. Span

Global Attribute – Class, ID and Style

Accordion – <Details> and <Summary>

Chapter 8. CSS Basics

What Is CSS?

CSS Syntax

Where To Type CSS?

CSS Basic Selectors

Descendant Selector

Inheritance

Specificity

Reset CSS

Browser Developer Tools for CSS

Comments in CSS Document

Chapter 9. Web Design Basics

Design Element Representation in HTML and CSS

Key Design Points by CSS

Length

Color Code – HEX and RGB

Color Theme

Chapter 10. CSS: Sizing and Spacing

CSS Box Model

width and height

padding

margin

Margin and Padding for Specific Side

margin: auto

box-sizing

Chapter 11. CSS: Styling Text and Images

Text Styling Properties

font-size

color

font-family

Web Font and Google Font

font-weight and font-style

text-decoration

line-height and letter-spacing

text-align

vertical-align

Styling Images

float: left and right

Chapter 12. CSS: Styling Backgrounds

background-color

background-image

background-size

background-repeat

background-position

background-attachment

background (Multiple Properties)

Chapter 13. CSS: Styling Borders and Drawing Lines

border-style

border-color

border-width

border-radius

Border (Multiple Properties)

Borders on Specific Side

Border Radius on Specific Side

Chapter 14. CSS: Layout – Key Concepts and Display Property

Layout Before and After

Layout Key Design Points

Display Property

inline, block and inline-block

display: none

Chapter 15. CSS: Layout – Flex Box

Flex Box – display: flex

flex-direction

Main Axis and Cross Axis

flex-wrap

justify-content

align-items

align-content

align-self

flex-grow

flex-shrink

flex-basis

margin: auto with Flex Box

Inline Flex Box

Nested Flex Box

Chapter 16. CSS: Styling Lists

List Styling Properties

list-style-type

list-style-image

list-style-position

Chapter 17. Creating and Styling Components

Components and Layout

Buttons

Cards

Top Bar

Footer and Bottom Bar

Chapter 18. Completing Website Development

Website Structure Design

Live Server

Home (Landing) Page Development

Main (List) Page Development

Content (Detail) Page Development

Chapter 19. Publishing Websites

Key Steps to Publish Websites

Domain and DNS Server

Favicon

GitHub Pages

Chapter 20. Supplemental Topics

Horizontal Rule – <hr>

Line Break – <br>

Reserved Characters and HTML Entities

Non-breaking Space – &nbsp;

Chapter 1. Overview of Website Development

How Websites Work?

Designing, Building and Publishing Websites

Designing Websites

Building Websites – Frontend and Backend Coding

Web App vs. Website

Frontend Coding

Web Framework and CMS

Publishing Websites (Hosting Services)

Chapter 2. Preparing for Website Coding

Two Key Tools to Start Coding Websites

How Browsers Display Web Pages

File Name Rules

Website Directory Structure

Absolute Path vs. Relative Path

Chapter 3. HTML Basics

What Is HTML?

HTML Element

Attribute

HTML Document Structure

Layout Semantics

Heading and Paragraph Tag

Text-Level Semantics

Space, Line-break and Tag in Content

Comments in HTML Document

Chapter 4. HTML: Add Links and Images

Overview of Adding Links and Images

Embed Images – <img>

Image File Format

Add Hyperlinks – <a>

Add Hyperlinks to Images

Add Hyperlinks to Specific Location on Web Page

Link Tag – <link>

Script Tag – <script>

Chapter 5. HTML: Create Lists and Tables

Create Lists

Create Tables

Combine Table Cells

Chapter 6. HTML: Create Forms

Create Forms

Create Text Input Forms and Submit Button

Radio Button and Checkbox

Select Box

Labels

Auto Complete and Disabled

Chapter 7. Bridging HTML and CSS

Block Element vs. Inline Element

Nesting Elements – Parent Elements and Child Elements

Div vs. Span

Global Attribute – Class, ID and Style

Accordion – <Details> and <Summary>

Chapter 8. CSS Basics

What Is CSS?

CSS Syntax

Where To Type CSS?

CSS Basic Selectors

Descendant Selector

Inheritance

Specificity

Reset CSS

Browser Developer Tools for CSS

Comments in CSS Document

Chapter 9. Web Design Basics

Design Element Representation in HTML and CSS

Key Design Points by CSS

Length

Color Code – HEX and RGB

Color Theme

Chapter 10. CSS: Sizing and Spacing

CSS Box Model

width and height

padding

margin

Margin and Padding for Specific Side

margin: auto

box-sizing

Chapter 11. CSS: Styling Text and Images

Text Styling Properties

font-size

color

font-family

Web Font and Google Font

font-weight and font-style

text-decoration

line-height and letter-spacing

text-align

vertical-align

Styling Images

float: left and right

Chapter 12. CSS: Styling Backgrounds

background-color

background-image

background-size

background-repeat

background-position

background-attachment

background (Multiple Properties)

Chapter 13. CSS: Styling Borders and Drawing Lines

border-style

border-color

border-width

border-radius

Border (Multiple Properties)

Borders on Specific Side

Border Radius on Specific Side

Chapter 14. CSS: Layout – Key Concepts and Display Property

Layout Before and After

Layout Key Design Points

Display Property

inline, block and inline-block

display: none

Chapter 15. CSS: Layout – Flex Box

Flex Box – display: flex

flex-direction

Main Axis and Cross Axis

flex-wrap

justify-content

align-items

align-content

align-self

flex-grow

flex-shrink

flex-basis

margin: auto with Flex Box

Inline Flex Box

Nested Flex Box

Chapter 16. CSS: Styling Lists

List Styling Properties

list-style-type

list-style-image

list-style-position

Chapter 17. Creating and Styling Components

Components and Layout

Buttons

Cards

Top Bar

Footer and Bottom Bar

Chapter 18. Completing Website Development

Website Structure Design

Live Server

Home (Landing) Page Development

Main (List) Page Development

Content (Detail) Page Development

Chapter 19. Publishing Websites

Key Steps to Publish Websites

Domain and DNS Server

Favicon

GitHub Pages

Chapter 20. Supplemental Topics

Horizontal Rule – <hr>

Line Break – <br>

Reserved Characters and HTML Entities

Non-breaking Space – &nbsp;