Create org chart positioning - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Create org chart positioning

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.orgChart ul {<!--from  w  ww .j  av  a  2s . c  o  m-->
   list-style:none outside none;
   margin:0 auto;
   padding:21px 0 0;
   position:relative;
   white-space:nowrap;
}

.orgChart ul li {
   vertical-align:top;
   display:inline-block;
   padding:21px 0 0 6px;
   position:relative;
   text-align:center;
   width:100px;
}

.orgChart ul li.admin,
.orgChart ul li.region {
   width:auto;
}

.orgChart ul li:first-child {
   padding-left:0;
}

.orgChart ul li:first-child:after {
   border-radius:6px 0 0;
}

.orgChart ul li:before, .orgChart ul li:after {
   border-top:2px solid Chartreuse;
   content:"";
   height:21px;
   position:absolute;
   right:51%;
   top:0;
   width:51%;
}

.orgChart ul li:after {
   border-left:2px solid yellow;
   left:51%;
   right:auto;
}

.orgChart ul li:only-child {
   padding-top:0;
}

.orgChart ul li:first-child:before, .orgChart ul li:last-child:after {
   border:0 none;
}

.orgChart ul li:last-child:before {
   border-radius:0 6px 0 0;
   border-right:2px solid blue;
}

.orgChart ul li .orgBlock {
   background:none repeat scroll 0 0 pink;
   border:2px solid OrangeRed;
   border-radius:6px;
   box-sizing:border-box;
   display:block;
   padding:6px 11px;
}

.orgChart ul li .orgBlock .orgName {
   display:block;
   font-weight:bold;
}

.orgChart ul li .orgBlock .orgUsers a {
   margin-left:100px;
   text-align:left;
}

.orgChart ul li .orgBlock .orgUsers a:first-child {
   margin-left:0;
}

.orgChart ul li .orgBlock.manager {
   text-align:left;
}

.orgChart ul ul:before {
   border-left:2px solid grey;
   content:"";
   height:21px;
   left:51%;
   margin-left:-2px;
   position:absolute;
   top:0;
   width:0;
}

.orgChart>ul {
   overflow-x:auto;
   padding:0 0 6px;
}
</style> 
 </head> 
 <body> 
  <div class="orgChart"> 
   <ul> 
    <li class="admin"> <span class="orgBlock"> <span class="orgName">Lorem ipsum </span> </span> 
     <ul> 
      <li class="region"> <span class="orgBlock region"> <span class="orgName">Lorem ipsum dol</span> </span> 
       <ul> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
       </ul> </li> 
      <li class="region"> <span class="orgBlock region"> <span class="orgName">Lorem ipsum dol</span> </span> 
       <ul> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
        <li> <span class="orgBlock manager">Lorem ips</span> </li> 
       </ul> </li> 
     </ul> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials