Показать сообщение отдельно
  #5 (permalink)  
Старый 23.12.2016, 18:17
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

bravoo,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  div{
    height: 10px;
    background-color: #FF0000;
  }
 p{
   background-color: #FF00FF;
   height: 10px;
 }

  </style>

  <script>
window.addEventListener('DOMContentLoaded', function() {
document.getElementsByClassName('firstclass')[0].style.width = document.getElementsByClassName('secondclass')[0].style.width;
  });


  </script>
</head>

<body>
<div class="firstclass" ></div>
<p></p>
<div class="secondclass" style="width: 300px"></div>
</body>
</html>
Ответить с цитированием