{"id":4454,"date":"2009-10-19T11:14:47","date_gmt":"2009-10-19T18:14:47","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=4454"},"modified":"2009-10-19T11:14:47","modified_gmt":"2009-10-19T18:14:47","slug":"top-bottom-halves-layout","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/html\/top-bottom-halves-layout\/","title":{"rendered":"Top & Bottom Halves Layout"},"content":{"rendered":"
<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\r\n\r\n<head>\r\n\t<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\" \/>\r\n\t\r\n\t<title>Top and Bottom Halves<\/title>\r\n\t\r\n\t<style type=\"text\/css\">\r\n\t   \r\n\t   * { margin: 0; padding: 0; }\r\n\t   p { padding: 20px; }\r\n\t   #top { background: #eee; }\r\n\t   #bottom { background: #ddd; }\r\n\t\r\n\t<\/style>\r\n\t\r\n\t<script src=\"http:\/\/www.google.com\/jsapi\" type=\"text\/javascript\"><\/script>\r\n    <script type=\"text\/javascript\">\r\n        google.load(\"jquery\", \"1.3.2\");\r\n    <\/script><script type=\"text\/javascript\">\r\n    \t$(function(){\r\n    \t\r\n    \t   var $window = $(window);\r\n    \t   winHeight = $window.height();\r\n    \t   \r\n    \t   $(\"#top\").height(winHeight\/2);\r\n    \t   $(\"#bottom\").height(winHeight\/2);\r\n    \t   \r\n    \t   $(window).resize(function(){\r\n\r\n    \t\t winHeight = $window.height();\r\n    \t\t \r\n    \t\t $(\"#top\").height(winHeight\/2);\r\n    \t     $(\"#bottom\").height(winHeight\/2);\r\n    \t\t \r\n           });\r\n    \t});\r\n    <\/script>\r\n<\/head>\r\n\r\n<body>\r\n\r\n    <div id=\"top\">\r\n        <p>Top Half<\/p>\r\n        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus<\/p>\r\n    <\/div>\r\n\r\n    <div id=\"bottom\">\r\n        <p>Bottom Half<\/p>\r\n        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus<\/p>\r\n    <\/div>\r\n\r\n<\/body>\r\n\r\n<\/html><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

<!DOCTYPE html PUBLIC “-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN” “http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd”> <html xmlns=”http:\/\/www.w3.org\/1999\/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text\/html; charset=UTF-8″ \/> <title>Top and Bottom Halves<\/title> <style type=”text\/css”> * { margin: 0; padding: 0; } p { padding: 20px; } #top { background: #eee; } #bottom { background: #ddd; } <\/style> <script src=”http:\/\/www.google.com\/jsapi” type=”text\/javascript”><\/script> <script type=”text\/javascript”> google.load(“jquery”, “1.3.2”); <\/script><script type=”text\/javascript”> $(function(){ […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3231,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":21004,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/track-window-resizes-through-google-analytics\/","url_meta":{"origin":4454,"position":0},"title":"Track Window Resizes through Google Analytics","date":"April 3, 2013","format":false,"excerpt":"Sparkbox has this snippet to help figure out how often browser windows really are resized. (function() { var resizeTimer; \/\/ Assuming we have jQuery present $( window ).on( \"resize\", function() { \/\/ Use resizeTimer to throttle the resize handler clearTimeout( resizeTimer ); resizeTimer = setTimeout(function() { \/* Send the event\u2026","rel":"","context":"In \"google analytics\"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4621,"url":"https:\/\/css-tricks.com\/snippets\/php\/discover-and-display-meta-tags\/","url_meta":{"origin":4454,"position":1},"title":"Discover and Display Meta Tags","date":"November 5, 2009","format":false,"excerpt":"This is a completely styled page which displays meta tag information it pulls from provided URLs. Change the URL's at the top of the code to change the websites it gathers the information from. Meta Tag Finder Meta Tag Finder NorthStar Media Author: Copyright: Description: Keywords: Robots: Generator: The Coupon\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5101,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/jquery-sticky-footer\/","url_meta":{"origin":4454,"position":2},"title":"jQuery Sticky Footer","date":"December 20, 2009","format":false,"excerpt":"In general the CSS Sticky Footer is the best way to go, as it works perfectly smoothly and doesn't require JavaScript. If the markup required simply isn't possible, this jQuery JavaScript might be an option. HTML Just make sure the #footer is the last visible thing on your page. Sticky\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4495,"url":"https:\/\/css-tricks.com\/snippets\/css\/fixed-positioning-in-ie-6\/","url_meta":{"origin":4454,"position":3},"title":"Fixed Positioning in IE 6","date":"October 24, 2009","format":false,"excerpt":"* { margin:0; padding:0; } html, body { height: 100%; } body #fixedElement { position:fixed !important; position: absolute; \/*ie6 and above*\/ top: 0; right: 0; } #page-wrap { width: 600px; margin: 0 auto; font: 16px\/2 Georgia, Serif; } The 100% height on the body and html stuff is in case\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9331,"url":"https:\/\/css-tricks.com\/snippets\/css\/gradient-underlines\/","url_meta":{"origin":4454,"position":4},"title":"Gradient Underlines","date":"May 10, 2011","format":false,"excerpt":"a { position: relative; padding-bottom: 2px; text-decoration: none; } a:hover::after { content: \"\"; position: absolute; bottom: 2px; left: 0; height: 1px; width: 100%; background: #444; background: linear-gradient(left, transparent 0%,#444 50%,transparent 100%); } See the Pen Gradient Underlines by Chris Coyier (@chriscoyier) on CodePen.","rel":"","context":"With 9 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":13570,"url":"https:\/\/css-tricks.com\/snippets\/css\/expanding-boxes-navigation\/","url_meta":{"origin":4454,"position":5},"title":"Expanding Boxes Navigation","date":"August 13, 2011","format":false,"excerpt":"From the v8 design of CSS-Tricks. View Demo nav { background: #444; border-bottom: 8px solid #E6E2DF; overflow: hidden; position: relative; width: 100%; } nav:after { content: \"\"; position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; background: white; } nav ul { background: -moz-linear-gradient(left, #444 0%, #444 50%, #41d05f\u2026","rel":"","context":"With 6 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4454"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=4454"}],"version-history":[{"count":1,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4454\/revisions"}],"predecessor-version":[{"id":4455,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4454\/revisions\/4455"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3231"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=4454"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=4454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}