How To Create A Triangle Using HTML and CSS?


STEP 1: Add <div class="triangle"></div> in the HTML document.

STEP 2: Add this CSS code.

.triangle{ 
 position: absolute;
 border-width: 50px;
 border-style: solid;
 border-color: transparent transparent black transparent;
 }

 

OUTPUT

 







Trending Posts

What Are The Use of Function Keys F1 to F12 on The Keyboard?

Easy Light Bulb Project: HTML, CSS, and JavaScript

5 Awesome Computer Shortcut Key Tricks You Must Try

12MP vs 48MP vs 64MP vs 108MP | Does More Megapixel Equal Better Image Quality?

Can I Code If I'm Bad at Math? (Spoiler: Yes, You Can!)

The Rise of Agentic AI: How Autonomous Coding Agents Are Replacing Junior Devs

What is an API in Web Development?

Build a Modern Gradient Calculator Using HTML, CSS, and JavaScript

Is Data Analyst a Good Career? Pros, Cons & Salary Insights

Bridging the Language Divide: How Modern IT Professionals Can Make Their Work Make Sense