SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    730
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Non-Overlapping Equal Height (Mouseover Effect)

    Hi,

    Is it possible to make an equal code page layout in which columns do no overlap. I am trying to apply a mousover effect on the columns but as they overlap this is not possible.


    Code:
    	width:100%;
    	clear:left;
       	font-family:Verdana, Geneva, sans-serif;
    }
    
    
    .homepagepopularsearchesmiddle {
    	float:left;
      	font-size:90%; 
    	width:100%;	
    	position:relative;
    	right: 33.33%; /*added by Cillian*/
    	clear:left;
       	font-family:Verdana, Geneva, sans-serif;
    }
    
    .homepagepopularsearches {
    	float:left;
    	font-size:90%;
    	position:relative;
    	width:100%;
    	right: 33.33%; /*added by Cillian*/
       	font-family:Verdana, Geneva, sans-serif;
    	background: #123456; 
    }
    
    .homepagepopularsearchescolumn1 {
     	float:left;
    	width:29.33%;
    	overflow:hidden;
    	left: 68.67%; /* added by Cillian */
    	position:relative;
    	background: #654321; 
    }
    
    .homepagepopularsearchescolumn1:hover {
    	background: #fff;  
    }
    
    .homepagepopularsearchescolumn2 {
    	overflow:hidden;
    	position:relative;
       	float:left;
    	width:29.33%;
    	left: 72.67%; /* added by Cillian */
    }
    
    
    .homepagepopularsearchescolumn3 {
    	overflow:hidden;
    	position:relative;
       	float:left;
    	width:29.33%;
    	left: 76.67%; /* added by Cillian */
    }
    
    .homepagepopularsearchesrightinner {
    	float:left;
    	width:48%;
    	padding-left: 1%;
    }

  2. #2
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,623
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    I'm sure someone else will understand what you mean - they always do. But I have no idea. Whats this mean?

    "make an equal code page layout"

  3. #3
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    730
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I have made some progress with it but I cant get the inner DIVs to balance out, any suggestions please?


    Code:
    <!DOCTYPE html>
    <head>
    <title>COLUMN TEMPLATE</title>
    <style type="text/css">
    body, html{
    	margin:0px;
    }
    #css-table { 
    		display: table; 
    	}
    #css-table .col1 { 
    			display: table-cell; 
    			width: 24%; 
    			border: 1px dashed #CFCFCF; 
    			padding: 10px;
    			background: #012345; 
    			overflow:hidden;		
    		}
    		
    #css-table .col2 { 
    			display: table-cell; 
    			width: 24%; 
    			padding: 10px;
    			background: #012345; 
    				border: 1px dashed #CFCFCF;
    		}
    
    #css-table .col3 { 
    			display: table-cell; 
    			width: 48%; 
    			padding: 10px;
    			background: #012345; 
    				border: 1px dashed #CFCFCF;
    		}
    		
    #css-table .col1:hover { 
    			background: #fff; 
    			border: 1px solid #CFCFCF;	
    		}
    				
    #css-table .col2:hover { 
    			background: #fff; 
    			border: 1px solid #CFCFCF; 
    		}
    			
    #css-table .col3:hover { 
    			background: #fff; 
    			border: 1px solid #CFCFCF; 
    		}
    
    	.homepagepopularsearchesrightinner {
       width:47%;
    padding-left: 1%;
    }
    
    	.col1inner {
       width:99%;
       border: 1px solid #CFCFCF; 
    }
    
    	.col2inner {
       width:99%;
       border: 1px solid #CFCFCF; 
    }
    
    	.col3inner {
       width:99%;
       border: 1px solid #CFCFCF; 
    }
    
    	.homepagepopularinner {
       width:99%;
    padding-left: 1%;
    border: 1px solid #CFCFCF; 
    }
    
    	.homepagepopularsearchesrightinner {
       width:48%;
        float:left;
    padding-left: 1%;
    	border: 1px solid #CFCFCF; 
    }
    
    .homepagepopularsearchesheader{
       float:left;
       width:95%;
     font-size:130%;
       font-family:Verdana, Geneva, sans-serif;
    }	
    		
    </style>
    </head>
    <body>
     	 
    <div class="content">
    <div id="css-table">
    <div class="col1">
    <div class="col1inner"><p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget magna eu mi luctus varius. Etiam pulvinar, dui ut laoreet mollis, ligula erat rutrum mauris, vel ultricies lectus sem in sem. Etiam lacinia commodo lacus, a ultricies sem tristique aliquam. Sed non odio dui. Proin metus elit, facilisis et accumsan nec, volutpat eu dolor. Nam rhoncus magna ut lacus ultrices id sodales nunc auctor. In tincidunt adipiscing dui, ac consequat nisi hendrerit sit amet. Duis posuere elementum ligula, vel pharetra odio semper eu. Sed feugiat ipsum elementum nulla consectetur sed accumsan risus elementum. Suspendisse non nibh odio. Duis gravida ultrices condimentum. Nullam varius fermentum dolor, ut pellentesque ipsum commodo sed.
    </p></div></div>
    <div class="col2">
    <div class="col2inner"><p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget magna eu mi luctus varius. Etiam pulvinar, dui ut laoreet mollis, ligula erat rutrum mauris, vel ultricies lectus sem in sem. Etiam lacinia commodo lacus, a ultricies sem tristique aliquam. Sed non odio dui. Proin metus elit, facilisis et accumsan nec, volutpat eu dolor. Nam rhoncus magna ut lacus ultrices id sodales nunc auctor. In tincidunt adipiscing dui, ac consequat nisi hendrerit sit amet. Duis posuere elementum ligula, vel pharetra odio semper eu. Sed feugiat ipsum elementum nulla consectetur sed accumsan risus elementum. Suspendisse non nibh odio. Duis gravida ultrices condimentum. Nullam varius fermentum dolor, ut pellentesque ipsum commodo sed.
    </p><p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget magna eu mi luctus varius. Etiam pulvinar, dui ut laoreet mollis, ligula erat rutrum mauris, vel ultricies lectus sem in sem. Etiam lacinia commodo lacus, a ultricies sem tristique aliquam. Sed non odio dui. Proin metus elit, facilisis et accumsan nec, volutpat eu dolor. Nam rhoncus magna ut lacus ultrices id sodales nunc auctor. In tincidunt adipiscing dui, ac consequat nisi hendrerit sit amet. Duis posuere elementum ligula, vel pharetra odio semper eu. Sed feugiat ipsum elementum nulla consectetur sed accumsan risus elementum. Suspendisse non nibh odio. Duis gravida ultrices condimentum. Nullam varius fermentum dolor, ut pellentesque ipsum commodo sed.
    </p></div></div>
    <div class="col3">		
    <div class="col3inner">	
    <div class="homepagepopularsearchesrightinner">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget magna eu mi luctus varius. Etiam pulvinar, dui ut laoreet mollis, ligula erat rutrum mauris, vel ultricies lectus sem in sem. Etiam lacinia commodo lacus, a ultricies sem tristique aliquam. Sed non odio dui. Proin metus elit, facilisis et accumsan nec, volutpat eu dolor. Nam rhoncus magna ut lacus ultrices id sodales nunc auctor. In tincidunt adipiscing dui, ac consequat nisi hendrerit sit amet. Duis posuere elementum ligula, vel pharetra odio semper eu. Sed feugiat ipsum elementum nulla consectetur sed accumsan risus elementum. Suspendisse non nibh odio. Duis gravida ultrices condimentum. Nullam varius fermentum dolor, ut pellentesque ipsum commodo sed.
    	</div>
    	<div class="homepagepopularsearchesrightinner">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget magna eu mi luctus varius. Etiam pulvinar, dui ut laoreet mollis, ligula erat rutrum mauris, vel ultricies lectus sem in sem. Etiam lacinia commodo lacus, a ultricies sem tristique aliquam. Sed non odio dui. Proin metus elit, facilisis et accumsan nec, volutpat eu dolor. Nam rhoncus magna ut lacus ultrices id sodales nunc auctor. In tincidunt adipiscing dui, ac consequat nisi hendrerit sit amet. Duis posuere elementum ligula, vel pharetra odio semper eu. Sed feugiat ipsum elementum nulla consectetur sed accumsan risus elementum. Suspendisse non nibh odio. Duis gravida ultrices condimentum. Nullam varius fermentum dolor, ut pellentesque ipsum commodo sed.
    	</div></div></div>
    </div><!-- end of table -->
    
    </div> <!--end of content div-->
    </body>
    </html>

  4. #4
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    730
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I am trying to create 3 columns with equal height with a mouseover effect on the background colour. But the two shortest div sink to the bottom.

  5. #5
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,222
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Thanks for the clarification.

    At this time, you have two selectors named .homepagepopularsearchesrightinner

    Replace both of them with one:

    Code:
    .homepagepopularsearchesrightinner {
        display:table-cell;
        width:50%;
        padding:0 2px;
        border: 1px solid #CFCFCF;
    }

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,594
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Looks like this is what you need:

    Code:
    .col1, .col2, .col3 {vertical-align:top;}
    Off Topic:

    I assume you are using really long class names because you are a masochist?

  7. #7
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,222
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Looks like this is what you need:

    Code:
    .col1, .col2, .col3 {vertical-align:top;}
    {vertical-align:top} in the cells would indeed fix the problem, but would not "cure" the cause... the use of floats within the table-cells.

  8. #8
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,731
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    Here is an alternate solution. T
    Code:
    <html>
    	<head>
    		<title></title>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    		<meta name="viewport" content="width=device-width">
    		<style type="text/css">
    			.outer{ background: pink;}
    			.inner{background: orange;margin-left:33.33333%;position: relative; }
    			.content { margin-right:50%;display: inline-block; vertical-align:top; width:50%;  background: cyan}
    			.col{ width:100%;}
    			.left{margin-left: -100%;float:left; }
    			.right{ margin-right:-100%;   float:right;}
    			.main {float:left; margin-right: -100%}
    			.left:hover:before, .right:hover:before, .main:hover:before {position: absolute; content:"";  width:50%; left:0; top:0; bottom:0;background: red ;  }
    			.right:hover:before {left:50%}
    			.left:hover:before {left:-50%}
    			.col>*{position: relative; z-index: 15}
    
     		</style>
    	</head>
    	<body>
    			<div class="outer">
    				<div class="inner">
    					<div class="content">
    							<div class="col main"><p>Main col</p></div>
    							<div class="col left "><p>Main col</p></div>
    							<div class="col right "><p>Main col</p></div>
    					</div>
    				</div>
    			</div>
    	
    	</body>
    </html>
    It may seem a little tag heavy ( and I only used a * selector because I am exhausted at the moment), the wrapper divs are necessary for the equal col bg hooks ( these can be solid color or image), and since we have to .col a width of 100%, we are best off putting any padding on an inner element so in a sense this is the best balanced practical solution( that i could come up with at this late hour) . Hope that helps.

    Off Topic:

    I assume you are using really long class names because you are a masochist?
    YAH!!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •