<!DOCTYPE html>
 StudyMuch

TOGGLE NAVIGATION

Valentine’s Day Card using HTML and CSS
Published by StudyMuch on February 4, 2024Valentine's Day Card using HTML and CSS
Creating a Valentine’s Day Card using HTML and CSS

Valentine’s Day is just around the corner, and what better way to express your love than with a personalized digital Valentine’s Day card! In this blog post, we’ll provide you with the full Source Code to create a charming Valentine’s Day Card using HTML and CSS, with code explanation of both HTML and CSS.

HTML Structure

Let’s start by examining the HTML structure of our Valentine’s Day Card:

<body>
 <div class="container">
 <div class="valentines">
  <div class="envelope"></div>
   <div class="front"></div>
 <div class="card">
  <div class="text">Happy</br>Valentine's Day!</div>
  <div class="texts">My Love!</div>
  <div class="heart"</div>
 </div>

 <div class="hearts">
  <div class="one"></div>
  <div class="two"></div>
  <div class="three"></div>
  <div class="four"></div>
  <div class="five"></div>
  </div>
 </div>
</div>
  <div class="shadow"></div>
  </div>
 </div>
<body/>
Document Structure

‘<!DOCTYPE html>‘: This declaration defines the document type and version of HTML being used. In this case, it’s HTML5.
‘<html lang=”en”>’: The root element of the HTML document. The lang attribute is set to “en” for English.
‘<head>’: Contains meta-information about the HTML document, such as character encoding and the document title.
‘<meta charset=”UTF-8″>’: Specifies the character encoding for the document, ensuring proper interpretation of special characters.
‘<title>Valentine Day Card By StudyMuch</title>’: Sets the title of the HTML document, which is displayed in the browser’s title bar or tab.
‘<style>’: This is where you include your CSS code. In this case, the actual CSS code is not provided in the example, but it’s indicated to be placed here.
Valentine's Day Card 


CSS Styles

Now, let’s break down the CSS styles used to create this Valentine’s Day Card:

</style>
body {
  display: flex;
  justify-content: center;
  align-items: center; 
  height: 100vh;
  background-color: #fdc3c9;
}

.container {
  position: relative;
}
.valentines {
  position: relative;
  top:50px;
  cursor: pointer;
  animation: up 3s linear infinite;
}

.envelope {
  position: relative;
  width: 300px;
  height:200px;
  background-color: #8202d2; 
  border: 2px solid rgb(76, 1, 25);
  border-radius: 5px;
}
.envelope:before {
  background-color: #8202d2; 
  content:"";
  position: absolute;
  width: 212px;
  height: 212px;
  transform: rotate(45deg);
  top:-105px;
  left:44px;
  border-radius:30px 0 0 0;
}
.card {
  position:relative;
  background-color: #ecbae6;
  width: 270px;
  height: 170px;
  bottom: 190px;
  left:15px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: -5px -5px 100px rgba(0,0,0,0.4); 
  animation: cd 3s linear infinite;  
}

@keyframes cd {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100px);
  }
}
.card:before {
  content:"";
  position: absolute;
  border:3px solid #a504f6;
  border-style: dotted;
  width: 240px;
  heighT: 140px;
  left:12px;
  top:12px;
  bottom: 0px;
}

.text {
  position: absolute;
  font-family: 'Brush Script MT', cursive;
  font-size: 28px;
  text-align: center;
  line-height:25px;
  top:19px;
  left:60px;
  color: #003049;
}

.texts {
  position: absolute;
  font-family: 'Brush Script MT', cursive;
  font-size: 25px;
  text-align: center;
  line-height:25px;
  top:70px;
  left:90px;
  color: #590293;
}

.heart {
  background-color: #d62828;
  display: inline-block;
  height: 30px;
  margin: 0 10px;
  position: relative;
  top: 110px;
  left:105px;
  transform: rotate(-45deg);
  width: 30px;
}

.heart:before,
.heart:after {
  content: "";
  background-color: #d62828;
  border-radius: 50%;
  height: 30px;
  position: absolute;
  width: 30px;
}

.heart:before {
  top: -15px;
  left: 0;
}
.heart:after {
  left: 15px;
  top: 0;
}
.front {
  position: absolute;
  border-right: 180px solid #8202d2;
  border-top: 95px solid transparent;
  border-bottom: 100px solid transparent;
  left:120px;
  top:5px;
  width:0;
  height:0;
  z-index:10;
}

.front:before {
  position: absolute;
  content:"";
  border-left: 300px solid #ac32f8;
  border-top: 195px solid transparent;
  left:-120px;
  top:-95px;
  width:0;
  height:0;
}

.shadow {
  position: absolute;
  width: 330px;
  height: 25px;
  border-radius:50%;
  background-color: rgba(0,0,0,0.3);
  top:265px;
  left:-15px;
  animation: scale 3s linear infinite;
  z-index:-1;
}

@keyframes up {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-30px);
  }
}

@keyframes scale {
  0%, 100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.85);
  }
}

.hearts {
  position: absolute  
}
.one, .two, .three, .four, .five {
  background-color: red;
  display: inline-block;
  height: 10px;
  margin: 0 10px;
  position: relative;  transform: rotate(-45deg);
  width: 10px;
  top:50px;
}
StudyMuch

TOGGLE NAVIGATION

Valentine’s Day Card using HTML and CSS
Published by StudyMuch on February 4, 2024Valentine's Day Card using HTML and CSS
Creating a Valentine’s Day Card using HTML and CSS

Valentine’s Day is just around the corner, and what better way to express your love than with a personalized digital Valentine’s Day card! In this blog post, we’ll provide you with the full Source Code to create a charming Valentine’s Day Card using HTML and CSS, with code explanation of both HTML and CSS.

HTML Structure

Let’s start by examining the HTML structure of our Valentine’s Day Card:

<body>
 <div class="container">
 <div class="valentines">
  <div class="envelope"></div>
   <div class="front"></div>
 <div class="card">
  <div class="text">Happy</br>Valentine's Day!</div>
  <div class="texts">My Love!</div>
  <div class="heart"</div>
 </div>

 <div class="hearts">
  <div class="one"></div>
  <div class="two"></div>
  <div class="three"></div>
  <div class="four"></div>
  <div class="five"></div>
  </div>
 </div>
</div>
  <div class="shadow"></div>
  </div>
 </div>
<body/>
Document Structure

‘<!DOCTYPE html>‘: This declaration defines the document type and version of HTML being used. In this case, it’s HTML5.
‘<html lang=”en”>’: The root element of the HTML document. The lang attribute is set to “en” for English.
‘<head>’: Contains meta-information about the HTML document, such as character encoding and the document title.
‘<meta charset=”UTF-8″>’: Specifies the character encoding for the document, ensuring proper interpretation of special characters.
‘<title>Valentine Day Card By StudyMuch</title>’: Sets the title of the HTML document, which is displayed in the browser’s title bar or tab.
‘<style>’: This is where you include your CSS code. In this case, the actual CSS code is not provided in the example, but it’s indicated to be placed here.
Valentine's Day Card 


CSS Styles

Now, let’s break down the CSS styles used to create this Valentine’s Day Card:

</style>
body {
  display: flex;
  justify-content: center;
  align-items: center; 
  height: 100vh;
  background-color: #fdc3c9;
}

.container {
  position: relative;
}
.valentines {
  position: relative;
  top:50px;
  cursor: pointer;
  animation: up 3s linear infinite;
}

.envelope {
  position: relative;
  width: 300px;
  height:200px;
  background-color: #8202d2; 
  border: 2px solid rgb(76, 1, 25);
  border-radius: 5px;
}
.envelope:before {
  background-color: #8202d2; 
  content:"";
  position: absolute;
  width: 212px;
  height: 212px;
  transform: rotate(45deg);
  top:-105px;
  left:44px;
  border-radius:30px 0 0 0;
}
.card {
  position:relative;
  background-color: #ecbae6;
  width: 270px;
  height: 170px;
  bottom: 190px;
  left:15px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: -5px -5px 100px rgba(0,0,0,0.4); 
  animation: cd 3s linear infinite;  
}

@keyframes cd {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100px);
  }
}
.card:before {
  content:"";
  position: absolute;
  border:3px solid #a504f6;
  border-style: dotted;
  width: 240px;
  heighT: 140px;
  left:12px;
  top:12px;
  bottom: 0px;
}

.text {
  position: absolute;
  font-family: 'Brush Script MT', cursive;
  font-size: 28px;
  text-align: center;
  line-height:25px;
  top:19px;
  left:60px;
  color: #003049;
}

.texts {
  position: absolute;
  font-family: 'Brush Script MT', cursive;
  font-size: 25px;
  text-align: center;
  line-height:25px;
  top:70px;
  left:90px;
  color: #590293;
}

.heart {
  background-color: #d62828;
  display: inline-block;
  height: 30px;
  margin: 0 10px;
  position: relative;
  top: 110px;
  left:105px;
  transform: rotate(-45deg);
  width: 30px;
}

.heart:before,
.heart:after {
  content: "";
  background-color: #d62828;
  border-radius: 50%;
  height: 30px;
  position: absolute;
  width: 30px;
}

.heart:before {
  top: -15px;
  left: 0;
}
.heart:after {
  left: 15px;
  top: 0;
}
.front {
  position: absolute;
  border-right: 180px solid #8202d2;
  border-top: 95px solid transparent;
  border-bottom: 100px solid transparent;
  left:120px;
  top:5px;
  width:0;
  height:0;
  z-index:10;
}

.front:before {
  position: absolute;
  content:"";
  border-left: 300px solid #ac32f8;
  border-top: 195px solid transparent;
  left:-120px;
  top:-95px;
  width:0;
  height:0;
}

.shadow {
  position: absolute;
  width: 330px;
  height: 25px;
  border-radius:50%;
  background-color: rgba(0,0,0,0.3);
  top:265px;
  left:-15px;
  animation: scale 3s linear infinite;
  z-index:-1;
}

@keyframes up {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-30px);
  }
}

@keyframes scale {
  0%, 100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.85);
  }
}

.hearts {
  position: absolute  
}
.one, .two, .three, .four, .five {
  background-color: red;
  display: inline-block;
  height: 10px;
  margin: 0 10px;
  position: relative;  transform: rotate(-45deg);
  width: 10px;
  top:50px;
}
StudyMuch

TOGGLE NAVIGATION

Valentine’s Day Card using HTML and CSS
Published by StudyMuch on February 4, 2024Valentine's Day Card using HTML and CSS
Creating a Valentine’s Day Card using HTML and CSS

Valentine’s Day is just around the corner, and what better way to express your love than with a personalized digital Valentine’s Day card! In this blog post, we’ll provide you with the full Source Code to create a charming Valentine’s Day Card using HTML and CSS, with code explanation of both HTML and CSS.

HTML Structure

Let’s start by examining the H

<body>
 <div class="container">
 <div class="valentines">
  <div class="envelope"></div>
   <div class="front"></div>
 <div class="card">
  <div class="text">Happy</br>Valentine's Day!</div>
  <div class="texts">My Love!</div>
  <div class="heart"</div>
 </div>

 <div class="hearts">
  <div class="one"></div>
  <div class="two"></div>
  <div class="three"></div>
  <div class="four"></div>
  <div class="five"></div>
  </div>
 </div>
</div>
  <div class="shadow"></div>
  </div>
 </div>

<body>
 <div class="container">
 <div class="valentines">
  <div class="envelope"></div>
   <div class="front"></div>
 <div class="card">
  <div class="text">Happy</br>Valentine's Day!</div>
  <div class="texts">My Love!</div>
  <div class="heart"</div>
 </div>

 <div class="hearts">
  <div class="one"></div>
  <div class="two"></div>
  <div class="three"></div>
  <div class="four"></div>
  <div class="five"></div>
  </div>
 </div>
</div>
  <div class="shadow"></div>
  </div>
 </div>
<body/>
</html> 

HTML Online Editor & Compiler

Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML. You can also specify the stylesheet information in styles.css tab and scripts information in scripts.js tab and start coding.

About HTML

HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.

Syntax help

Fundamentals

  • Any HTML document must start with document declaration <!DOCTYPE html>
  • HTML documents begin with <html> and ends with </html>
  • Headings are defined with <h1> to <h6> where <h1> is the highest important heading and <h6> is the least important sub-heading.
  • Paragrahs are defined in <p>..</p> tag.
  • Links are defined in <a> tag.

    Example:

    <a href="https://onecompiler.com/html">HTML online compiler</a>
    
  • Images are defined in <img> tag, where src attribute consists of image name.
  • Buttons are defined in <button>..</button> tag
  • Lists are defined in <ul> for unordered/bullet list and <ol> for ordered/number list, and the list items are defined in <li>.

HTML Elements and Attributes

  • HTML element is everything present from start tag to end tag.
  • The text present between start and end tag is called HTML element content.
  • Anything can be a tagname but it's preferred to put the meaningful title to the content present as tag name.
  • Do not forget the end tag.
  • Elements with no content are called empty elements.
  • Elements can have attributes which provides additional information about the element.
  • In the below example, href is an attribute and a is the tag name.

    Example:

    <a href="https://onecompiler.com/html">HTML online compiler</a>
    

CSS

CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.

Example:

Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.

body{
  padding: 25px;
}
.title {
	color: #228B22;
	font-family: Candara;
}

HTML Tables

  • HTML Tables are defined in <table> tag.
  • Table row should be defined in <tr> tag
  • Table header should be defined in <th> tag
  • Table data should be defined in <td> tag
  • Table caption should be defined in <caption> tag

HTML-Javascript

  • Javascript is used in HTML pages to make them more interactive.
  • <script> is the tag used to write scripts in HTML
  • You can either reference a external script or write script code in this tag.

Example

<script src="script.js"></script>