Introduction to CSS | Part 1 | Build Your Own Static Website | Cheat Sheet

 

HTML Elements

1. Container Element

The HTML div element defines a container.

<div>

  <h1>Tourism</h1>

  <p>Plan your trip wherever you want to go</p>

  <button>Get Started</button>

</div>


CSS Properties

2. Syntax

selector {
  property1: value1;
  property2: value2;
}

3. Text Align

The CSS text-align property specifies the horizontal alignment of the text in an HTML element.

.h-center {
  text-align: center;
}





example:-

HTML Code:-

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <div class="h-center">
      <h1>Tourism</h1>
      <p>Plan your trip wherever you want to go</p>
      <button>Get Started</button>
    </div>
  </body>
</html>

CSS Code:-

.h-center {
  text-align: center;
}

Output:-




Comments

Popular posts from this blog

Introduction to CSS Box Model | Part 1 | Build Your Own Static Website | Cheat Sheet