Serhiy Serhiy - 6 months ago 37
Sass (Sass) Question

How to set div's width equal to another div using sass/css?

I have first element:

<div layout="column" layout-align="start center" class="focusBox flex "></div>

it's css:

.focusBox {
margin-top: 2%;
border: 1px solid $alto;
height: calc(100vh - 182px);
background-color: $white;

and second element:

<div flex class="subFolderBox" ></div>

it's css:

.subFolderBox {
margin-bottom: 1%;
border: 1px solid $alto;

How to set width of first element to second using sass or css?


im not sure about css/scss but if you prefer with jquery you can do it like this

$(document).ready(function() {
    'width': ($(".first_div").width() + 'px')
.first_div {
  border: 1px solid black;
  padding: 2px 4px;
  display: inline-block;
<script src=""></script>
<div class="first_div">First Div some text</div>
<div class="second_div">Second.width </div>