Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS/Jquery Layout: make two columns same height
    primarykey
    data
    text
    <p>To be honest, I am not strong on CSS layout. My question is to make the left sidebar having the same height with the right context part. My web code structure:</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebTest.Default" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"&gt; &lt;link href="Styles/StyleSheet1.css" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;div id="wrap"&gt; &lt;div id="header"&gt; &lt;h1&gt; TEST&lt;/h1&gt; &lt;/div&gt; &lt;div id="nav"&gt; &lt;asp:Button ID="Lookup" runat="server" Text="Lookup" CssClass="nav_buttons" ClientIDMode="Static"/&gt; &lt;/div&gt; &lt;div id="sidebar"&gt; &lt;asp:Button ID="Button1" runat="server" Text="Button1" ClientIDMode="Static" CssClass="sidebar_buttons" OnClick="Button1_Click" /&gt; &lt;asp:Button ID="Button2" runat="server" Text="Button2" CssClass="sidebar_buttons" /&gt; &lt;/div&gt; &lt;div id="gridview"&gt; &lt;/div&gt; &lt;div id="btnSave"&gt; &lt;asp:Button ID="Edit" runat="server" Text="Edit" OnClientClick="javascript:Edit_Click();return false;" CssClass="btnEdit"/&gt; &lt;asp:Button ID="Cancel" runat="server" Text="Cancel" CssClass="btnEdit" OnClientClick="javascript:Cancel_Click();return false;" /&gt; &lt;/div&gt; &lt;script&gt; $(document).ready(function () { var divwrap = $("#wrap").height(); var divgridview = $("#gridview").height(); var divheader = $("#header").height(); var divnav = $("#nav").height(); var divbtn = $("#btnSave").height(); $("#sidebar").height(divbtn); }); $('.sidebar_buttons').click(function (event) { $("#&lt;%=Edit.ClientID %&gt;").show(); $("#&lt;%=Cancel.ClientID %&gt;").show(); }); &lt;/script&gt; &lt;/div&gt; </code></pre> <p> The web page snapshot: <img src="https://i.stack.imgur.com/Smdxt.png" alt="Test page"> The sidebar is a little higher then the right. Not sure which variable should be used in jquery. When I debugged into the code, I found divbtn is a big number, why? CSS:</p> <pre><code>#wrap { width: 800px; background-color: #99c; } #header { border-style: solid; border-width: 1px; background-color: #ddd; width: 800px; padding-top: 30px; padding-bottom: 30px; } #nav { background-color: #c99; padding-top: 30px; padding-bottom: 30px; width: 800px; border-style: solid; border-width: 1px; } #sidebar { float: left; width: 125px; padding-top: 10px; background-color: #C0C0C0; } #gridview { float: right; overflow: scroll; width: 675px; } .sidebar_buttons { margin-top: 10px; margin-left: 2px; width: 120px; } h1 { margin-left: 50px; } .nav_buttons { margin-left: 50px; width: 120px; } .btnEdit { width: 60px; margin-left: 75px; margin-top: 50px; } #btnSave { margin-left: 30px; } </code></pre> <p>Thanks for help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload