Website Do
Website Do
Hello, friends today in this blog I will teach you how to Create A Website in HTML and CSS
Only. Earlier I have shared a blog about a Complete Personal Portfolio Website using HTML
CSS & JavaScript and now I'm going to create a simple website.
What is a Website?
A website is a combination of several web pages of codes, and hyperlinks, and designs. There
are various types of websites like E-commerce websites, Portfolio websites, magazines, or Social
Media Websites actually blog is also a website. The website can be used for educational or
marketing and other purposes. Websites have no limited boundaries.
If you are feeling difficulty with what I'm saying then you can watch the full video tutorial of this
program [Create A Website Design], which I have given below.
I have provided all the HTML, CSS code files of this website below, before jumping on the
source code file, you need to know some basics of this.
As you have seen in this tutorial [Website Desing], first there is a full-screen size image. On the
top left side there is a logo of my youtube channel as a CodingLab, On the right top side there are
some hyperlinks with hover animation, and in the center, there is a two-button with hover
animation. As you have seen when that hyperlinks and buttons are covered white background
appears with little animation, hyperlinks, and button text color changed into black.
If you have general knowledge about HTML & CSS then you can easily create this Website
Design or if you have knowledge about JavaScript then you can add other functions as per your
need. For those friends who are feeling difficulty creating this program, I will provide full source
code files of this program[Create A Website in HTML & CSS Only].
HTML CODE:
<!DOCTYPE html>
<!-- Created By CodingNepal - www.codingnepalweb.com -->
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!------<title> Website Layout | CodingLab</title>------>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/5.15.2/css/all.min.css"/>
</head>
<body>
<nav>
<div class="menu">
<div class="logo">
<a href="#">CodingLab</a>
</div>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Feedback</a></li>
</ul>
</div>
</nav>
<div class="img"></div>
<div class="center">
<div class="title">Create Amazing Website</div>
<div class="sub_title">Pure HTML & CSS Only</div>
<div class="btns">
<button>Learn More</button>
<button>Subscribe</button>
</div>
</div>
</body>
</html>
Copy Codes
CSS CODE:
@import url('https://fonts.googleapis.com/css2?
family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins',sans-serif;
}
::selection{
color: #000;
background: #fff;
}
nav{
position: fixed;
background: #1b1b1b;
width: 100%;
padding: 10px 0;
z-index: 12;
}
nav .menu{
max-width: 1250px;
margin: auto;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
}
.menu .logo a{
text-decoration: none;
color: #fff;
font-size: 35px;
font-weight: 600;
}
.menu ul{
display: inline-flex;
}
.menu ul li{
list-style: none;
margin-left: 7px;
}
.menu ul li:first-child{
margin-left: 0px;
}
.menu ul li a{
text-decoration: none;
color: #fff;
font-size: 18px;
font-weight: 500;
padding: 8px 15px;
border-radius: 5px;
transition: all 0.3s ease;
}
.menu ul li a:hover{
background: #fff;
color: black;
}
.img{
background: url('img3.jpg')no-repeat;
width: 100%;
height: 100vh;
background-size: cover;
background-position: center;
position: relative;
}
.img::before{
content: '';
position: absolute;
height: 100%;
width: 100%;
background: rgba(0, 0, 0, 0.4);
}
.center{
position: absolute;
top: 52%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
padding: 0 20px;
text-align: center;
}
.center .title{
color: #fff;
font-size: 55px;
font-weight: 600;
}
.center .sub_title{
color: #fff;
font-size: 52px;
font-weight: 600;
}
.center .btns{
margin-top: 20px;
}
.center .btns button{
height: 55px;
width: 170px;
border-radius: 5px;
border: none;
margin: 0 10px;
border: 2px solid white;
font-size: 20px;
font-weight: 500;
padding: 0 10px;
cursor: pointer;
outline: none;
transition: all 0.3s ease;
}
.center .btns button:first-child{
color: #fff;
background: none;
}
.btns button:first-child:hover{
background: white;
color: black;
}
.center .btns button:last-child{
background: white;
color: black;
}
Copy Codes
Simple website Download HTML CSS Source Code. You can also directly download all source
code from the following download button.
Blog »
How to create website using HTML &
CSS (+Copy/Paste code)
Open your HTML file using the text editor and try pasting these
codes:
<!DOCTYPE html>
<html>
<head>
<title>WEBCODE</title>
<link rel=”stylesheet” href=”style.css”>
</head>
<body>
<h1>Look! It’s working! :)</h1>
</body>
</html>
After saving the text document, try it out and open it in a web
browser to see if it’s working.
Look! You just successfully wrote your first lines of code!
Adding the Elements
If you’re finished with the boilerplate, now let us add some
elements in the web page just like what you have planned in
your draft. This is done by adding some semantic elements like
<header>, <main>, <section>, and <footer>.
Try opening your HTML file and replace your previous code with
these ones:
<!DOCTYPE html>
<html>
<head>
<title>WEBCODE</title>
<link rel=”stylesheet” href=”style.css”>
</head>
<body>
<header>
</header>
<main>
<section id=”hero”>
</section>
<section id=”about”>
</section>
<section id=”contact”>
</section>
</main>
<footer>
</footer>
</body>
</html>
Since we are only creating sections of the page, you will not see
anything when you open the file in the browser.
Now we are done with HTML and your web page should have the
intended HMTL contents just like what we have drafted in the
layout.
Adding CSS Basic Layout
After finishing with the HTML contents, your web page is ready
to read. However, one would also think that such an
appearance may seem a little bit plain. We wouldn’t want to
publish a website that will not attract visitors now, would we
think this article might be helpful for you to learn more about
how to increase traffic to your website.
READ The Importance of a Website Design for Your Business (2021)
header {
display: flex;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
line-height: 50px;
background-color: #eee;
}
header * {
display: inline;
height: 50px;
}
headerul {
padding: 0;
}
header li {
margin-left: 20px;
}
section {
height: 100vh;
border: 1px solid black;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
#hero .profile-img {
width: 300px;
}
footer {
text-align: center;
padding: 50px;
}
The above codes arrange the layouts to make sure that the sections
are set to 100% viewport height, which basically means filling the
size of your screen, to fix the position of the header and arrange the
navigation bar in the header, as well as use flexboxes to center the
contents in the sections.
As a result, we would have our web page below:
The web page is slowly turning into what we have expected, isn’t it?
Adding CSS styles
Now that the contents have all properly placed, we can add
some formats to style the web page.
Open your CSS file and revise it according to below CSS code:
body {
margin: 0;
margin-top: 50px;
font-family: sans-serif; /* Add this line */
}
header {
display: flex;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
line-height: 50px;
background-color: #eee;
}
header * {
display: inline;
height: 50px;
}
headerul {
padding: 0;
}
header li {
margin-left: 20px;
}
section {
height: 100vh;
border: 1px solid black;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
#hero .profile-img {
width: 300px;
border-radius: 50%; /* Add this line */
}
footer {
text-align: center;
padding: 50px;
}
#hero h1 {
font-size: 3em;
}
section h2 {
font-size: 2.5em;
}
section h3 {
font-size: 1.5em;
}
header a {
text-decoration: none;
color: black;
}
Now open your web page again and you will see that the font type
and sizes have changed, and the default styling from the header
links has also changed.
Let us enhance the web page appearance even more!
Colors and Backgrounds
Now we are going to add some final touch of colors and
background to our web page to make it more appealing. This
article on Jimdo contains useful information about choosing
the best background for your website.
Before typing more codes, you may want to upload the pictures of
your choice to the image hosting site just like it is mentioned on
step #6 and copy the URL of the picture.
Revise the CSS document according to the following CSS code:
body {
margin: 0;
margin-top: 50px;
font-family: sans-serif;
}
header {
display: flex;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
line-height: 50px;
background-color: #eee;
}
header * {
display: inline;
height: 50px;
}
headerul {
padding: 0;
}
header li {
margin-left: 20px;
}
section {
height: 100vh;
border: 1px solid black;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
#hero .profile-img {
width: 300px;
border-radius: 50%;
}
footer {
text-align: center;
padding: 50px;
}
#hero h1 {
font-size: 3em;
}
section h2 {
font-size: 2.5em;
}
section h3 {
font-size: 1.5em;
}
header a {
text-decoration: none;
color: black;
}
/* Add everything below here */
#hero {
background-image: linear-
gradient(rgba(255,255,255,0.75),rgba(255,255,255,0.75)),
url(‘https://scontent.fcgk18-2.fna.fbcdn.net/v/t1.0-
9/60903720_10219096913924536_7793117871105638400_n.jpg?
_nc_cat=104&_nc_ht=scontent.fcgk18-
2.fna&oh=0699be50b4ae038bf8f3da4b5bbced8f&oe=5D58596E‘);
}
#about {
background-image: linear-
gradient(rgba(255,255,255,0.75),rgba(255,255,255,0.75)),
url(‘https://scontent.fcgk18-2.fna.fbcdn.net/v/t1.0-
9/60232304_10219096916964612_1350888178050924544_n.jpg?
_nc_cat=100&_nc_ht=scontent.fcgk18-
2.fna&oh=72784f19fd9cf8cf9ca99d7dfc53735b&oe=5D54C31C‘);
}
#contact {
background-image: linear-
gradient(rgba(255,255,255,0.75),rgba(255,255,255,0.75)),
url(‘https://scontent-sin6-1.xx.fbcdn.net/v/t1.0-
9/60586842_10219096915844584_3123709442135162880_n.jpg?
_nc_cat=107&_nc_ht=scontent-sin6-
1.xx&oh=870f6e76c4eae89bba33c7ab76d37127&oe=5D554E78‘);
}
Paste the URLs of your pictures into the green-colored texts above
to change the background into your desired pictures.
By entering the above codes, we have modified the background
images and adding a semi-transparent overlay on top by using the
code linear-gradient(rgba(255,255,255,0.75),rgba(255,255,255,0.75)),
before the image URL (‘image.jpg’)to make the texts more readable.
If everything was entered right, our web page is finished and good
to go:
Congratulations! Your first web page is completed!
Check and recheck!
Computer language is complex. There are many codes to enter
and there are cases where codes are mistyped and contents are
not inserted right. It is always recommended that you check
and recheck before publishing your website.
As we all know, once the content is posted on the internet, it stays
out there.
Once you are done rechecking, you may publish your webpage and
show it off.
Putting it briefly, designing your own website is not really that
complicated and frightening as long as we are willing to learn.
Please note that the above article emphasizes more on the step-by-
step guide to creating a web page using simple HTML and CSS
code rather than focusing on the technicality of the code.
Stay confident and keep learning!
Comment
Name EmailWebsite
Save my name, email, and website in this browser for the next
time I comment.
Post Comment