Jump to content
  • 0

Почему у меня колонки не становятся одной высотой?


DivMan
 Share

Question

Хочу 3 блока выровнять, что бы были все одной высоты через javascript, но почему-то они не выравниваются, помогите найти причину.
 
Вроде я всё правильно указал

 

Файл находится в папке js

 

b15f967f05168aaf9eb71bc653439bb5.jpg

 

 

_________________________________________________________________________________________________________

 

Файл index

 

0052d5e4a0038d7eebd9470c08e6f63a.jpg

 

Папка с сайтом  http://yadi.sk/d/AeesgXxbF7Ffn

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Почему не выравниваются колонки?? помогите найти причину

<!DOCTYPE html><html>	<head>		<title>Сайт</title>		<meta http-equiv="content-type" content="text/html; charset=UTF-8">		<link rel="stylesheet" type="text/css" href="style.css">		<script src="http://code.jquery.com/jquery-latest.js"></script>        <script type="text/javascript">    	   $(document).ready(function(){    	       function setEqualHeight(columns){                     var tallestcolumn = 0;                     columns.each(function(){                        currentHeight = $(this).height();                        if(currentHeight > tallestcolumn){                            tallestcolumn  = currentHeight;                        }                     });                    columns.height(tallestcolumn);               }               setEqualHeight($("#sidebar_L,#sidebar_R,#content"));    	   });        </script>		<style>            #wrapper{	width: 800px;	outline:1px solid #cccccc;	padding: 10px;	margin: 0 auto;	}#header{	height:77px;	background:#f8ac18;	margin-bottom: 12px;}#sidebarL{		background:#ebebeb;	margin-bottom: 12px;	width: 150px;	float: left;}#sidebarR{		background:#ebebeb;	margin-bottom: 12px;	width: 150px;	float: right;}#content{		background:#c5161d;	margin: 0 auto 12px auto;	width: 480px;	margin-left: 160px;}#footer{	height:77px;	background:#111111;	margin-bottom: 12px;}.clear{	clear:both;}        </style>	</head><body>		<div id="wrapper">		<div id="header"></div>		<div id="sidebarL">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam laoreet, risus et lobortis suscipit, est nisl congue turpis, et vestibulum nisi libero a mauris. Praesent varius volutpat ipsum, nec scelerisque dolor vehicula ut. Curabitur ut enim sit amet sapien interdum gravida eget quis nulla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus faucibus, tempus tellus blandit, bibendum leo. Nam dictum libero eget placerat eleifend. Praesent nisl neque, tempus at pharetra ut, euismod non felis. Fusce commodo erat leo, sed molestie erat pretium ac. Etiam sit amet pretium purus, sed scelerisque enim. Mauris ornare molestie tortor, in cursus justo sodales vel. Mauris vestibulum, lectus nec pulvinar hendrerit, turpis felis venenatis nulla, ac lacinia dui magna vel velit. Pellentesque ultricies mattis justo, nec porta enim condimentum quis. </div>		<div id="sidebarR">Curabitur ut enim sit amet sapien interdum gravida eget quis nulla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus faucibus, tempus tellus blandit, bibendum leo. Nam dictum libero eget placerat eleifend. Praesent nisl neque, tempus at pharetra ut, euismod non felis. Fusce commodo erat leo, sed molestie erat pretium ac. Etiam sit amet pretium purus, sed scelerisque enim. Mauris ornare molestie tortor, in cursus justo sodales vel. Mauris vestibulum, lectus nec pulvinar hendrerit, turpis felis venenatis nulla, ac lacinia dui magna vel velit. Pellentesque ultricies mattis justo, nec porta enim condimentum quis. </div>		<div id="content">Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam sagittis mi justo, vel interdum orci faucibus vel. Maecenas eget massa id ligula accumsan dignissim. Curabitur ut aliquam nibh, a accumsan augue. Phasellus sollicitudin erat in tempor condimentum. Sed tincidunt fringilla nunc id ullamcorper. Aliquam a turpis est. Ut turpis erat, mollis vitae massa vel, fermentum elementum orci. Morbi ultrices leo a sollicitudin bibendum. Curabitur auctor quam sit amet nulla molestie, non dignissim mi dapibus. Sed laoreet nec libero sit amet gravida. Nulla lacinia velit sed lorem interdum, vel pulvinar diam euismod. Mauris pellentesque mi in ipsum fermentum, sit amet rutrum ligula aliquet. </div>		<div class="clear"></div>		<div id="footer"></div>			</div>  </body></html>

а почему в здесь выравнивается, в чём разница???

<html>    <head>        <script src="http://code.jquery.com/jquery-latest.js"></script>        <script type="text/javascript">    	   $(document).ready(function(){    	       function setEqualHeight(columns){                     var tallestcolumn = 0;                     columns.each(function(){                        currentHeight = $(this).height();                        if(currentHeight > tallestcolumn){                            tallestcolumn  = currentHeight;                        }                     });                    columns.height(tallestcolumn);               }               setEqualHeight($("#content,#sidebar"));    	   });        </script>        <style>            div {                border: solid 1px gray;                width: 100px;                float: left;            }        </style>    </head>        <body>        <div id="content">asdgas dgasdgas dgasgd asdg asdg asdg asdg asd asg asdgas dgasg asdg asdg asdg asdg </div>        <div id="sidebar">as dgasd gasdg asd asd asdg asdg asdg asd gasdg asd</div>    </body></html> 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy