<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: layout code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 06 Sep 2008 13:58:24 GMT</pubDate>
    <description>DZone Snippets: layout code</description>
    <item>
      <title>CSS *true* centering</title>
      <link>http://snippets.dzone.com/posts/show/5252</link>
      <description>This will truely center something in CSS. Not tested in IE, knowing IE, it will burn in flames.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#center-me { /* There can be only one Centerlander! */&lt;br /&gt;  height: 100%;&lt;br /&gt;  display: table !important;&lt;br /&gt;  margin: auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#center-me &gt; * {&lt;br /&gt;  display: table-cell !important; /* Don't touch me! I MEAN IT! DON- ... don't touch me. Really, don't touch me. */&lt;br /&gt;  vertical-align: middle !important;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;div id="center-me"&gt;&lt;br /&gt;  &lt;h1&gt;I'm centered!&lt;/h1&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Wed, 19 Mar 2008 07:30:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5252</guid>
      <author>elliottcable (elliott cable)</author>
    </item>
    <item>
      <title>Slashdot's 3 column liquid layout</title>
      <link>http://snippets.dzone.com/posts/show/4741</link>
      <description>The following html and css code is an example of a 3 column liquid layout used on the front page of http://slashdot.org. What's interesting is that the left and right column do not change their widths, it's only the article content which changes.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;&lt;br /&gt;  &lt;title&gt;Aenean: ullamcorper elementum, dui quam porttitor neque&lt;/title&gt;&lt;br /&gt;  &lt;link rel="stylesheet" type="text/css" media="screen" href="core-tidied.css" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;div id="frame"&gt;&lt;br /&gt;  &lt;div id="topnav"&gt;&lt;br /&gt;    &lt;div id="logo"&gt;&lt;br /&gt;      &lt;h1&gt;&lt;br /&gt;        &lt;a href="//aenean.org"&gt;Aenean&lt;/a&gt;&lt;br /&gt;      &lt;/h1&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;/div&gt; &lt;br /&gt;  &lt;div id="slogan"&gt;&lt;br /&gt;    &lt;h2&gt;&lt;br /&gt;      ullamcorper elementum, dui quam porttitor neque&lt;br /&gt;    &lt;/h2&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;  &lt;div id="wrapper"&gt;&lt;br /&gt;    &lt;div id="links"&gt;&lt;br /&gt;      &lt;div class="block" id="links-sections"&gt;&lt;br /&gt;        &lt;div class="title" id="links-sections-title"&gt;&lt;br /&gt;          &lt;h4&gt;&lt;br /&gt;                  hendrerit&lt;br /&gt;          &lt;/h4&gt;&lt;br /&gt;        &lt;/div&gt;&lt;br /&gt;        &lt;div class="content" id="links-sections-content"&gt;&lt;br /&gt;          &lt;ul&gt;&lt;br /&gt;          &lt;li&gt;suscipit&lt;/li&gt;&lt;br /&gt;          &lt;/ul&gt;&lt;br /&gt;        &lt;/div&gt;&lt;br /&gt;      &lt;/div&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;    &lt;div id="contents"&gt;&lt;br /&gt;      &lt;div id="slashboxes"&gt;	&lt;br /&gt;        &lt;div class="block"&gt;&lt;br /&gt;          &lt;div class="title" id="index_qlinks-title"&gt;&lt;br /&gt;            &lt;h4&gt;&lt;br /&gt;                    Vestibulum&lt;br /&gt;            &lt;/h4&gt;&lt;br /&gt;          &lt;/div&gt;&lt;br /&gt;          &lt;div class="content" id="index_qlinks-content"&gt;&lt;br /&gt;            &lt;p&gt;egestas quam &lt;/p&gt;&lt;br /&gt;          &lt;/div&gt;&lt;br /&gt;        &lt;/div&gt;&lt;br /&gt;      &lt;/div&gt;&lt;br /&gt;      &lt;div id="articles"&gt;&lt;br /&gt;        &lt;div class="article" id="art1"&gt;&lt;br /&gt;          &lt;p&gt;&lt;br /&gt;          Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec tincidunt porttitor felis. Sed a tellus in lacus adipiscing tincidunt. Ut sollicitudin auctor dolor. Maecenas orci. Fusce porttitor odio eget erat. Aliquam erat volutpat. Fusce mollis, orci eget ullamcorper elementum, dui quam porttitor neque, euismod pulvinar risus turpis nec neque. Maecenas dolor risus, vestibulum in, congue a, pulvinar id, leo. Vestibulum porttitor hendrerit mauris. Morbi fringilla lectus quis orci. Vivamus laoreet massa scelerisque felis.&lt;br /&gt;          &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;          &lt;p&gt;&lt;br /&gt;          Aenean nunc neque, euismod porta, tempor ut, eleifend at, massa. Nam tempor urna at ligula. Etiam auctor dui tempus odio egestas sagittis. Donec metus pede, tempor nec, tincidunt sit amet, consectetuer eget, massa. Nam dolor arcu, ornare et, imperdiet vel, euismod ut, nibh. Quisque ut erat. Maecenas ante urna, suscipit eget, dictum non, porttitor at, magna. Duis accumsan. Suspendisse luctus vehicula pede. Mauris a nisl. Cras leo.&lt;br /&gt;          &lt;/p&gt;&lt;br /&gt;        &lt;/div&gt;&lt;br /&gt;      &lt;/div&gt;&lt;br /&gt;    &lt;/div&gt;	&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;  &lt;div id="footer"&gt;&lt;br /&gt;    Ut sollicitudin auctor dolor. Maecenas orci. &lt;br /&gt;  &lt;/div&gt;	&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;/* file: core-tidied.css */&lt;br /&gt;body {&lt;br /&gt;  min-width: 680px;&lt;br /&gt;  color: #111;&lt;br /&gt;  background: #222;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#contents p {&lt;br /&gt;  background-color: #eee;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#topnav {&lt;br /&gt;  background: #044;&lt;br /&gt;  position: relative;&lt;br /&gt;  height: 55px;&lt;br /&gt;  margin: 5px 1.25em 0 1.25em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;  #topnav #logo {&lt;br /&gt;    width: 415px;&lt;br /&gt;    height: 100%;&lt;br /&gt;  }&lt;br /&gt;  #topnav #logo h1 {&lt;br /&gt;    display: block;&lt;br /&gt;    height: 100%;&lt;br /&gt;    width: 100%;&lt;br /&gt;  }&lt;br /&gt;    #topnav #logo h1 a {&lt;br /&gt;      display: block;&lt;br /&gt;      width: 100%;&lt;br /&gt;      height: 100%;&lt;br /&gt;      outline: none;&lt;br /&gt;      text-indent: -5000px;&lt;br /&gt;      text-decoration: none;&lt;br /&gt;      background: url(//images.slashdot.org/logo.png) no-repeat left top;&lt;br /&gt;    }&lt;br /&gt;  &lt;br /&gt;#slogan{ display: none; }&lt;br /&gt;&lt;br /&gt;/* Wrapper */&lt;br /&gt;#wrapper {&lt;br /&gt;  overflow: hidden;&lt;br /&gt;  background-color: #fff;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#wrapper #articles { margin-right: 18.5em; }&lt;br /&gt;&lt;br /&gt;/* User section menu */&lt;br /&gt;/* Contents */&lt;br /&gt;#contents {&lt;br /&gt;  width: auto;&lt;br /&gt;  margin-left: 10.5em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* General Body */&lt;br /&gt;&lt;br /&gt;/* Blocks */&lt;br /&gt;div.block div.title { background: #666 }&lt;br /&gt;  div.block div.title h4 {&lt;br /&gt;    color: #fff;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Links (left sidebar) */&lt;br /&gt;div#links {&lt;br /&gt;  float: left;&lt;br /&gt;  width: 9.25em;&lt;br /&gt;  background: #eee;&lt;br /&gt;}&lt;br /&gt;    div#links div.block div.content ul li {  list-style-image: none; }&lt;br /&gt;&lt;br /&gt;/* Slashboxes (right sidebar) */&lt;br /&gt;div#slashboxes {&lt;br /&gt;  float: right;&lt;br /&gt;  width: 17.25em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* Footer */&lt;br /&gt;div#footer {&lt;br /&gt;  background: #bbb;&lt;br /&gt;  clear: both;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#contents {margin-top: 2em;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The secret to positioning the columns, is to use left and right margins to push the element (column being adjusted), away from it's siblings.  In the above example the contents (outer box) is pushed away from the left (#contents {  margin-left: 10.5em;}), and the articles (inner box) within the contents is pushed from the right (#wrapper #articles { margin-right: 18.5em;  }).&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Wed, 07 Nov 2007 12:10:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4741</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Form input layout css</title>
      <link>http://snippets.dzone.com/posts/show/3064</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;label&lt;br /&gt;{&lt;br /&gt;    width:250px;&lt;br /&gt;    float:left;&lt;br /&gt;    clear:both;&lt;br /&gt;}&lt;br /&gt;            &lt;form action="contact.php" method="POST"&gt;&lt;br /&gt;                &lt;ul id="contact"&gt;&lt;br /&gt;                    &lt;li&gt;&lt;br /&gt;                        &lt;label for="name"&gt;Name:&lt;/label&gt;&lt;br /&gt;                        &lt;input type="text" name="name" /&gt;&lt;br /&gt;                    &lt;/li&gt;&lt;br /&gt;                    &lt;li&gt;&lt;br /&gt;&lt;br /&gt;                        &lt;label for="email"&gt;Email:&lt;/label&gt;&lt;br /&gt;                        &lt;input type="text" name="email" /&gt;&lt;br /&gt;                    &lt;/li&gt;&lt;br /&gt;                    &lt;li&gt;&lt;br /&gt;                        &lt;label for="message"&gt;Message:&lt;/label&gt;&lt;br /&gt;                        &lt;textarea name="message"&gt;&lt;/textarea&gt;&lt;br /&gt;                    &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;                    &lt;li&gt;&lt;br /&gt;                        &lt;input type="Submit" name="send" value="Send" /&gt;&lt;br /&gt;                    &lt;/li&gt;&lt;br /&gt;                &lt;/ul&gt;&lt;br /&gt;            &lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 30 Nov 2006 17:26:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3064</guid>
      <author>FROST (Frost Design)</author>
    </item>
    <item>
      <title>Nested layouts</title>
      <link>http://snippets.dzone.com/posts/show/1639</link>
      <description>I was missing some feature in Rails - nested layouts. So I took some time and implemented it:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;module ApplicationHelper&lt;br /&gt;  def inside_layout(layout, &amp;block)&lt;br /&gt;    @template.instance_variable_set("@content_for_layout", capture(&amp;block))&lt;br /&gt;    &lt;br /&gt;    layout = layout.include?("/") ? layout : "layouts/#{layout}" if layout&lt;br /&gt;    buffer = eval("_erbout", block.binding)&lt;br /&gt;    buffer.concat(@template.render_file(layout, true))&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then, design your views to use e.g. 'inner_layout'.&lt;br /&gt;&lt;br /&gt;In 'layouts/inner_layout.rhtml' write:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;% inside_layout 'outer_layout' do %&gt;&lt;br /&gt;&lt;br /&gt; layout stuff&lt;br /&gt;  &lt;%= @content_for_layout %&gt;&lt;br /&gt;&lt;br /&gt;&lt;% end %&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The 'outer_layout.rhtml' will go as ussual layout (unless it needs to be nested in other higher level layout)&lt;br /&gt;</description>
      <pubDate>Mon, 06 Mar 2006 13:00:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1639</guid>
      <author>maxim.kulkin (Maxim Kulkin)</author>
    </item>
    <item>
      <title>More rails conditional layouts</title>
      <link>http://snippets.dzone.com/posts/show/236</link>
      <description>In your controller:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  layout :my_layout_func&lt;br /&gt;&lt;br /&gt;  ...&lt;br /&gt;&lt;br /&gt;protected&lt;br /&gt;&lt;br /&gt;  def my_layout_func&lt;br /&gt;   # anything ruby will work&lt;br /&gt;   ['list','index',nil].include?(action_name)? &lt;br /&gt;   'noheading':'my_layout'&lt;br /&gt; &lt;br /&gt;   # or you could do&lt;br /&gt;   case action_name&lt;br /&gt;    when 'monkey': 'monkey_layout'&lt;br /&gt;    when 'edit'  : 'form_layout'&lt;br /&gt;   end&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt; </description>
      <pubDate>Fri, 29 Apr 2005 11:56:13 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/236</guid>
      <author>courtenay (courtenay)</author>
    </item>
  </channel>
</rss>
