zoukankan      html  css  js  c++  java
  • 关于让左右2个DIV高度相等

    哪个div Height值大,就将其值赋给Height值小的div,从而使2个div高度始终保持一

    以下是代码:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>div高度相等</title>
    <style type="text/css">
    #left{background:#999999; float:left; 100px;}
    #right{background:#0066FF; color:#fff; 300px; float:left; }
    .clear{clear:both;}
    </style>
    </head>
    <body>
    <h3>1. 右边div内容高度高于左边div</h3>
    <div id="left">

    没有别条路能走你决定要不要陪我

    讲不听偏爱看我感觉爱

    等你的依赖

    不后悔有把握

    我不闪躲 我非要这麽做

    讲不听也偏要爱 更努力爱让你明白

    没有别条路能走你决定要不要陪我

    讲不听偏爱看我感觉爱

    等你的依赖 对你偏爱

    痛也很愉快

       </div>
    <div id="right">
    偏爱
    </div>
    <script type="text/javascript" src="js/jquery-1.12.3.js"></script>
    <script type="text/javascript">
    function $(id){
    return document.getElementById(id)
    }
    function getHeight() {
    if ($("left").offsetHeight>=$("right").offsetHeight){
    $("right").style.height=$("left").offsetHeight + "px";
    }
    else{
    $("left").style.height=$("right").offsetHeight + "px";
    }
    }
    window.onload = function() {
    getHeight();
    }

    </script>
    </body>
    </html>
  • 相关阅读:
    Go 好用第三方库
    Go 的beego 框架
    Go 的gin 框架 和 gorm 和 html/template库
    Go 常用的方法
    Dijkstra 的两种算法
    邻接矩阵
    next permutation 的实现
    最优二叉树 (哈夫曼树) 的构建及编码
    思维题— Count the Sheep
    STL— bitset
  • 原文地址:https://www.cnblogs.com/yf-html/p/5662471.html
Copyright © 2011-2022 走看看