Solution 1 :

This gap is caused by line-height in p tag:

.vertical p{
  line-height: 0;
}

.vertical a{
  line-height: 100%;
}

Solution 2 :

use font-size: 0;

cause one blank Between them(X)

cause font-size: 0; so line-height: 0;(O)

* {
    margin: 0;
    padding: 0;
/*     font-family: arial, verdana, tahoma; */
    

}
.fzZero{
  font-size: 0;
}
div {
    margin: 1em 2em;
}

div::after {
    content: "";
    clear: both;
    display: table;
  }


ul {
	padding-top: 20px;
  position: relative;
	
	transition: all 0.5s;
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
}

li {
	float: left;
  text-align: center;
	list-style-type: none;
	position: relative;
	padding: 20px 5px 0 5px;
	
	transition: all 0.5s;
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
}

/*We will use ::before and ::after to draw the connectors*/
li::before, li::after{
	content: '';
	position: absolute; top: 0; right: 50%;
	border-top: 1px solid #ccc;
	width: 50%; height: 20px;
}
li::after{
	right: auto; left: 50%;
	border-left: 1px solid #ccc;
}

/*We need to remove left-right connectors from elements without 
any siblings*/
li:only-child::after, li:only-child::before {
	display: none;
}

/*Remove space from the top of single children*/
li:only-child{ padding-top: 0;}

/*Remove left connector from first child and 
right connector from last child*/
li:first-child::before, li:last-child::after{
	border: 0 none;
}
/*Adding back the vertical connector to the last nodes*/
li:last-child::before{
	border-right: 1px solid #ccc;
	border-radius: 0 5px 0 0;
	-webkit-border-radius: 0 5px 0 0;
	-moz-border-radius: 0 5px 0 0;
}
li:first-child::after{
	border-radius: 5px 0 0 0;
	-webkit-border-radius: 5px 0 0 0;
	-moz-border-radius: 5px 0 0 0;
}

/*Time to add downward connectors from parents*/
ul ul::before{
	content: '';
	position: absolute; top: 0; left: 50%;
	border-left: 1px solid #ccc;
	width: 0; height: 20px;
}

li a{
	border: 1px solid #ccc;
	padding: 5px 5px;
	text-decoration: none;
	color: #666;
	font-family: arial, verdana, tahoma;
	font-size: 12px;
	display: inline-block;
	
	border-radius: 5px;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	
	transition: all 0.5s;
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
}

/* This gonna cause the space */
.vertical a {
	writing-mode: vertical-lr;
}
<html>
  <head></head>
  <body>
    <div class="vertical fzZero">
    <ul>
    <li>
    <p><a href="#">one<br>two<br>tt</a></p>
    <ul>
    <li><a href="#">three</a></li>
    </ul>
    </li>
    </ul>
    </div>
    
    <hr>

    <div class="normal">
    <ul>
    <li>
    <p><a href="#">four<br>five</a></p>
    <ul>
    <li><a href="#">six</a></li>
    </ul>
    </li>
    </ul>
    </div>
  </body>
</html>

Problem :

I created an unordered list in HTML,
and used some lines to show the relations,
but when I rotate the text with

writing-mode: vertical-rl;

I got a gap between <p> and inner <a> like this:

enter image description here

The element <a> contains one<br>two, and its parent <p> has only one child.

And this is my code on codepen, how can I eliminate the gap pointed by the red arrow?

Comments

Comment posted by Windsting

I tried this, it does removed the gap, but it also removed the margin of the

Comment posted by donkey

mh…, cause font-size: 0 make line-height: 0 , so right answer is “line-height: 0”!

By