How to add dynamic CSS using CSS

Forums CSSHow to add dynamic CSS using CSS
Staff asked 2 years ago

For example,

two-column are there.

one column’s width set 200px. and which CSS needs to add for the second column so it’s set in one line with responsive.

Answers (1)

Add Answer
Prince Dhameliya Marked As Accepted
Staff answered 2 years ago

If you want which CSS needs to add for the second column so it’s set in one line with responsive so please review the example.

First of all, create HTML in the index.html file.

<body>
  <div class="row">
    <div class="first-col">
      <h2>First col</h2>
    </div>
    <div class="second-col">
      <h2>Second col</h2>
    </div>
  </div>
</body>

Then add CSS in <style>…</style> tag on index.html file.

.row{
    display: flex;
  }
  .first-col{
    width: 200px;
    background: #ddd;
  }
  .second-col{
     width: calc(100% - 200px);
     background: #eee;
  }

I have used the calc()function.

Please review the video.

I hope you guys found something useful  ??

Subscribe

Select Categories