layout - CSS to place a div within an area of another (not parent) div -
having css troubles , hoping can me. i'm trying place #aside right of #landing don't share same parent. unfortunately can't alter structure of divs (otherwise i'd put #aside within #container , it's fixed), looking solution.
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <head> <title>test layout</title> <link rel="stylesheet" type="text/css" href="temp.css" /> </head> <body> <div id="main"> main <div id="container"> container <div id="content"> content - lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <div id="landing"> landing </div> </div> </div> <div id="aside"> aside </div> </div> </body> </html>
css:
#main { height: auto; width: 988px; background-color: aqua; } #container { height: auto; width: 988px; background-color: blue; } #content { height: auto; width: 988px; background-color: fuchsia; float: left; } #landing { height: auto; width: 632px; padding-right: 20px; background-color: green; float: left; } #aside { height: auto; width: 316px; border-left: 1px solid black; background-color: maroon; float: right; }
(this intended more comment answer, little long inserted as comment.)
the easiest way use javascript, jquery in particular offers chance apply:
$(document).ready( function(){ $('#aside').insertafter('#landing'); });
if must use css only, @jere notes, you're stuck using negative margins.
Comments
Post a Comment