0 html javascript css jquery less
如何使用LESS获得任何元素的高度?
<html>
<head>
<title></title>
<style>
html, body {
height: 100%;
}
header {
height: auto;
text-align: center;
background: red;
}
@windowHeight: `$(window).height()`;
@headerHeight: `$('header').height()`; /* NOT WORKING */
@sectionHeight: @windowHeight - @headerHeight;
section {
height: ~'@{sectionHeight}px';
text-align: center;
background: green;
}
</style>
</head>
<body>
<header>TITLE<header>
<section>TEXT</section>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如何使用LESS获得任何元素的高度?
如果我设置了示例<header> height = 100px,则此代码正常工作