<div id="down"></div> <!-- down arrow -->
<div id="normal"></div> <!-- normal - why is this not square -->
<div id="up"></div> <!-- up arrow -->
<div id="left"></div> <!-- left arrow -->
<div id="right"></div> <!-- right arrow -->
Just to be sure you understand what I posted, just copy that code to a new file, give it a name that ends with .htm or .html and double click it to open it in your browser. I coded the boxes blue instead of transparent so the shapes would be obvious.
You can also try the box-sizing property and see if that appeals to you.
Interesting. In the first post, you asked why the box was not square. In the latest JSFiddle, you have added 10px of padding-right to all boxes so they are certainly not square.
{font-size:0} is not necessary. It is one of several techniques used to eliminate space between inline-block objects such as inline list items, but there is nothing for the font-size to affect these boxes, so it is not necessary.
Here’s another version to play with ‘just for fun’. :stir:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Easy CSS Triangle "Arrows"</title>
<!--
http://www.sitepoint.com/forums/showthread.php?1218971-CSS-Arrows
2014.07.25 05:02
tahirjadoon
-->
<style type="text/css">
/* consider using the box-sizing property. Enable it, and see how the "normal" box changes. */
/*
*, *:before, *:after {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
*/
#normal, #down, #up, #left, #right {
width: 50px;
height: 50px;
background-color: green;
position:relative;
padding:6px;
/* margin-bottom: 20px; */
margin:20px;
}
#normal {
border: 6px solid blue;
border-top-color: red;
padding:0;
}
#down::after {
content:"";
display:block; /* ADD Me */
width: 0;
height: 0;
border: 6px solid blue;
border-top-color: red;
position:absolute;
top:100%;
right:0;
}
#up::after {
content:"";
display:block; /* ADD Me */
width: 0;
height: 0;
border: 6px solid blue;
border-bottom-color: red;
position:absolute;
bottom:100%;
left:0;
}
#left::after {
content:"";
display:block; /* ADD Me */
width: 0;
height: 0;
border: 6px solid blue;
border-right-color: red;
position:absolute;
bottom:0;
right:100%;
}
#right::after {
content:"";
display:block; /* ADD Me */
width: 0;
height: 0;
border: 6px solid blue;
border-left-color: red;
position:absolute;
top:0;
left:100%;
}
</style>
</head>
<body>
<div id="normal"></div> <!-- normal - why is this not square -->
<div id="up"></div> <!-- up arrow -->
<div id="down"></div> <!-- down arrow -->
<div id="left"></div> <!-- left arrow - not setting properly-->
<div id="right"></div> <!-- right arrow - not setting properly -->
</body>
</html>