All In One Script



PHP,HTLM,CSS,Jquery,AJAX,Javascript and etc doubts and sample codes

  • Home
  • Javascript
  • PHP
  • CSS
  • SQL/MYSQL

How do CSS triangles work?

by Blogger 3:46:00 AM CSS css-shapes css3 geometry polygon

How do CSS triangles work?

There're plenty of different CSS shapes over at CSS Tricks - Shapes of CSS and I'm particularly puzzled with a triangle:
CSS Triangle
#triangle-up {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 100px solid red;
}
<div id="triangle-up"></div>

How and why does it work?


Answer:

CSS Triangles: A Tragedy in Five Acts

As alex said, borders of equal width butt up against each other at 45 degree angles:
borders meet at 45 degree angles, content in middle
When you have no top border, it looks like this:
no top border
Then you give it a width of 0...
no width
...and a height of 0...
no height either
...and finally, you make the two side borders transparent:
transparent side borders
That results in a triangle.
The End



http://stackoverflow.com/questions/7073484/how-do-css-triangles-work



READ MORE
SHARE :

Search This Blog

Followers

  • Popular
  • Recent
  • Comments
    Serving XHTML and self-closing tags
    How to efficiently iterate over each Entry in a Map?
    Get first key in a (possibly) associative array?
    How to avoid Java code in JSP files?
    Does finally always execute in Java?
    Solved : curl_init() function not working in Ubuntu
    Why does this code using random strings print “hello world”?
    In Java, difference between default, public, protected, and private
    How can I make the cursor a hand when a user hovers over a list item?
    Length of a JavaScript object

Instagram

About

Popular Posts

  • Serving XHTML and self-closing tags
    Serving XHTML and self-closing tags I am trying to follow the xhtml 1.0 strict standard as I am creating my website. Right now, validat...
  • How to efficiently iterate over each Entry in a Map?
    How to efficiently iterate over each Entry in a Map? If I have an object implementing the  Map  interface in Java and I wish to iterate...
  • Get first key in a (possibly) associative array?
    Get first key in a (possibly) associative array? What's the best way to determine the first key in a possibly associative array? My...
  • How to avoid Java code in JSP files?
    How to avoid Java code in JSP files? I'm new to Java EE and I know that something like the following three lines <%= x + 1 %...
  • Does finally always execute in Java?
    Does finally always execute in Java? I have a try/catch block with  return s inside it. Will the finally block be called? For example...
  • Solved : curl_init() function not working in Ubuntu
    Solved : curl_init() function not working in Ubuntu  Here solved the error  Fatal error: Call to undefined function curl_init() ...
  • Why does this code using random strings print “hello world”?
    Why does this code using random strings print “hello world”? The following print statement would print "hello world". Could a...
  • In Java, difference between default, public, protected, and private
    In Java, difference between default, public, protected, and private In Java , are there clear rules on when to use each of access modifi...
  • How can I make the cursor a hand when a user hovers over a list item?
    How can I make the cursor a hand when a user hovers over a list item? I've got a list, and I have a click handler for its items: ...
  • Length of a JavaScript object
    Length of a JavaScript object If I have a JavaScript object, say var myObject = new Object (); myObject [ "firstname" ] ...

statcounter



statcounter



Template Created By ThemeXpose & Blogger Templates