JSFiddle - React, Tailwind, and code Playground

by rome_margo

HTML

<div id="ok">
    <ul>
        <li>1</li>
        <li id="3">3</li>
        <li id="4">4</li>
        <li>5</li>
    </ul>
</div>

CSS

#ok{
  width:450px;
  height:50px;
  border:1px solid black;
  position:relative;
  overflow:hidden;
  }
#ok ul{
  position:absolute;
  width:250px;
  height:50px;
  right:-50px;
  text-align:center;
  line-height:50px;
  }
#ok ul li{
  float:left;
  width:50px;
  height:50px;
  background:#CCC;
  }

JavaScript

alert($('#3').offset().left + $('#3').width());