CSS - Aligning From The Bottom Of A Page?
Is there a way to align something from the bottom of the page?
Similar TutorialsSo I'm still on my quest to be able to create my 1st entirely CSS site, and need some help as I'm not sure how to do this. I want to be able to align a navigation list at the bottom right of the content area. Also while I'm at it, I want the site to be at a minimum 462px (just an example), but would like for it to increase in height if the content itself expands beyond the 462. And the navigation menu, I'd like to somehow keep at the bottom right of the viewable area. Thanks... here's the code... HTML Code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" /> </head> <body> <div class="outer"> <div class="logo"> <img src="images/logo.gif" /> </div> <div class="spacer"> </div> <div class="nav"> <a href="#">Link 1</a><br /> <a href="#">Link 2</a><br /> <a href="#">Link 3</a><br /> <a href="#">Link 4</a><br /> <a href="#">Link 5</a><br /> <a href="#">Link 6</a> </div> <div class="content"> <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do 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." </p> </div> </div> </body> </html> CSS Code: Code: body {padding:0px; margin:0px; } div.outer {background-image:url('images/bg2.jpg'); background-repeat:no-repeat; width:770px; height:462px; } div.logo {text-align:right; padding:10px; height:75px; } div.spacer {float:left; width:200px;} div.nav {float:right; text-align:right; padding:20px; } div.content {background-image:url('images/bg3.jpg'); width:400px; padding:20px; } .nav a{text-decoration:none; color:black; font-size:20px; font-family:"sans serif", verdana, arial; } .nav a:hover{text-decoration:underline; } hey all, here's my test page http://www.pyesnflpool.com/ at the top... Im trying to get the two links (Register & Recover Your Password) to be beside the arrows and Email Pye beside the mail image it is running off two scripts, one for the links (snippetSideLine)and the other is holding together the header (elementTopPage) As you can see on side-b I was making some effort to align them to the bottom with no success, my thoughts were to align to the bottom and than do a padding-bottom: 15px; or whatever, because I tried padding-top:120px to side-a which put the links in the right spot but left the rest of the page all over the place any help is much appreciated, thanks Code: <!-- snippetSideLine --> <div> <?php if (isset ($this->User) && !empty ($this->User)) { if ($this->User->Type == 1) { ?> <a href="../admin/index.php">Admin Panel</a> <?php } ?> <a href="../members/myaccount.php">My Account</a> <a href="index.php?Logout">Logout</a> <?php } else { ?> <a href="../members/register.php">Register</a> <a href="../members/forgotten.php">Recover Your Password</a> <?php } ?> </div> <!-- End: snippetSideLine --> Code: <!-- start: elementTopPage --> <style type="text/css"> #wrapper { text-align: left; vertical-align: text-bottom; margin: 0px auto; padding: 0px; border:0; width: 850px; } #side-a { float: left; width: 458px; height: 167px; background: url('../images/top_left.jpg') no-repeat; } #side-b { float: right; width: 168px; height: 167px; vertical-align: text-bottom; vertical-align: baseline; background: url('../images/top_right.jpg') no-repeat; } #content { float: left; width: 224px; height: 167px; background: url("../images/top_bg.jpg") repeat; } </style> <!-- elementTopPage --> </head> <body> <div id="wrapper"> <div id="container"> <div id="side-a"> <?php $this->Snippet ('SideLine'); ?> </div> <div id="content"> </div> <div id="side-b"> email pye </div> </div> </div> <!-- End: elementTopPage --> I'd like to have a container, a row, really. And I'd like text aligned to the top of the div, and then some more text aligned to the bottom of the div, like this: ------------------------------------------ Top text Bottom text ------------------------------------------ The thing is, I can't use tables, so if someone knows how to accomplish in a completely tableless way, I'd appreciate it! I did try the following, but it didn't work: Code: .mainDiv{ position: relative; float: left; width: 150px; } .mainDiv .upper { top: 0; position: absolute; } .mainDiv .lower { bottom: 0; position: absolute; } Hello, Let's say this... I have an element that has a height of 600px. I have an element inside of that element that I want aligned to the very bottom. How could I accomplish this feat? Ok, so I just used Pagination for the first time (Yay). I'm creating a make shift shopping cart, and was trying to align "Add to Cart" to show at the bottom of the product listing. Right now, the products show 5 per row, and the format is: image of item item name price Then there is some padding and I want the submit button to appear at the very bottom of the div (within the a href if possible). I have the a href set as display:block, so when hovered over, the area is gray. I want the submit button to be within that area. I have tried with several variations (I did move the </a> to after the </form> line: - Placed the <form> lines within a separate div and tried aligning it to the bottom using margin-bottom - Tried styling the <input> using margin-bottom as well. My knowledge of divs isn't really that good as I never really used them much before, so I'm sure it's something simple enough. Right now when I do place it in the <a href></a> area, the Add to Cart button shows up right under the item_name... so it's staggered as item names may take up 1, 2, or 3 lines. And keeping it under the link area makes the button too far down. If you need further info, let me know. Here's the code to pulling the info from the products table: Code: $query = "SELECT `id`, `image`, `item_name`, `msrp` FROM products $limit"; $result = mysql_query($query, $conn) or die(mysql_error()); $i == 0; while($row = mysql_fetch_array($result)) { extract($row); $i ++; $image_loc = "images/products/" . $image; $j = $i/5; $display .= "<div id=\"store\"><a href=\"view_item.php?id= ".$id."\"><img src=\"".$image_loc . "\" style=\"width:100px; padding-bottom:5px;\"><br />" . $item_name . "</a>"; if ($logged_in != 'false') { $display .= "<form action=\"add_cart.php\" method=\"post\">"; $display .= "<input type=\"hidden\" value=\"".$id."\">"; $display .= "<input style=\"margin-left:20px;\" type=\"submit\" value=\"Add to Cart\">"; $display .= "</form>"; $display .= "</div>"; } if (is_int($j)) { $display .= "<div style=\"clear:both;\"></div>"; } else { } } Here's the CSS: Code: #store {width:150px; float:left; padding-bottom:30px; padding-left:15px; padding-right:15px; } #store a{display:block; text-decoration:none; padding:10px; height:200px; } #store img{border:0; } #store a:hover{background:#ccc;} Hi, I'm having a problem which I though should be fairly simple, but I've been hacking at it for many hours now. I want to align blocks horizontally at the bottom of a containing block. The containing block has a fixed height while the contained block do not. Here's a mockup of what I want: URL How should I modify the following code so that it renders like the above? Code: <div style="height:50px"> <div style="float:left">one</div> <div style="float:left">two</div> </div> Thanks! I have decided to move another of my sites over to css, but I seem to be stuck at the first problem. I have added a small code sample... What I am wanting to do is remove the table and acheive the same result with css and div tags. How can I align text to the bottom right with css like the sample code? PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Text aligned bottom right</title> </head> <body> <table border=0 height="90px" width="100%"> <tr><td style="vertical-align: bottom;background:white;text-align:right;"> <a href="">Home</a> | <a href="">About</a> | <a href="" >Contact</a> </td></tr></table> </body> </html> I seem to have messed up while slicing...If my font size is too large, it'll mess up my table positioning...I'd like to know if there's any way to align text to the bottom of a table collumn? Is there anything I can put in my style sheet to do this? Am I not being clear enough? Please help. EDIT : I've got a picture uploaded. See how on the left there's that white space? And under "Welcome" there's also a lot of space? I figure if I could align the text to the bottom, it'd fix both problems. =/ Please view: http://www.archanix.com/aib/about/ Notice the red square aib logo towards the bottom of the page. I have been successful in aligning the image to the bottom of the div. But because I'm using position:relative; bottom:72px; it pushes my footer down farther than I want. Any way i can get around that? Any help would be greatly appreciated. Thanks, Jesse The problem that I am having stems from attempted compatability for 1. IE/other browsers, and 2. Not scrolling or having an absurd amount of dead space on different resolutions. Given that I'm currently using a 16:9 laptop, anything that I make for my resolution is very likely to scroll vertically on anything else. I would like to preface this by saying that, while I am a young person and am .. relatively web savvy, I'm also pretty miserable at CSS. I'll pick it up whenever I need to use it, but these times generally end up being a year plus apart, and so I generally .. forget everything that I picked up the last time, and have to re-learn. I am very good at nesting tables, and using an absurd number of them to get things to look how I want, but .. I really want to get away from that. CSS is cleaner and less .. well, less flat out dumb than using seven tables in one page to align things the way you want them? The Actual Problem I Have: (Do ignore the hideously coloured background, the green/blue combo is temporary until I get the code working properly. Anyway, so apparently I can't post URLs so: clocktock.com is the website in question, code on it is Code: <html> <head> <link rel="stylesheet" type="text/css" href="poing.css"> <link rel="icon" type="image/png" href="img/RL16.png"/> <title>[ eroding.net ]</title></head> <body> <table cellspacing="0" cellpadding="0" class="main" height="100%" width="100%" valign="bottom"><tr><td width=100% align=center valign="bottom"> <table border="0" cellspacing="0" cellpadding="0" height="90%"> <tr><td background="img/top_left.png" width=14 height=39></td> <td background="img/top.png" width=622 height=39><img src="img/top_left2.png" border=0></td> <td background="img/top_right.png" width=14 height=39></tr></td> <tr><td background="img/left.png" width=14 height=1></td> <td bgcolor="black" width="700" height="800" border=0 cellspacing=0 cellpadding=0 background="img/table_bg_grunge.png" valign="top"> <br><br> <center> aaa <br><br> </center> </td><td background="img/right.png" width=14></tr></td></table> </tr></td></table> </body></html> CSS Code: body { font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; font-family: Tahoma, Arial; background-color: #0F0F0F; color: #424242; background: url(img/damask.png); background-attachment: fixed; background-repeat: repeat; margin-bottom: 0px; vertical-align: bottom;} table { color: #424242; font: 11px Tahoma, Arial; margin: 0px; } sm {font-size: 0.9em; } a:link { color: #424242; } a:visited { color: #595959; } a:hover { color: #424242; text-decoration:none; } a:active { color: #424242; } What I would, ideally, like to have is for the box to take a percentage of space. Say, vertically 80 or 90%, and then a blank remainder on the top. Horizontally, say, 10 or 15% on either side and then 70 or 80% for the "box." But, google as I might, I just can't find the right CSS commands to do it. It just gets funny looking and shrinks all my border images (Though I erased the code that caused that). Hey guys. You can run an image, a border, text, whatever you want off the top of the page, but can you do it with the bottom of the page. Code: .top { position: relative; left: 0px; top: -75px; } That will of course run an image off the top of the page, but Code: .bottom { position: relative; left: 0px; bottom: -250px; } this line of code will simply but the image relative to the top image and it's completely visible, meaning the user can view the entire image simply by scrolling down. I'm placing my <id>'s in tables right now, but I'm open to whatever. I simply want an image consistently, running off the top of the page and the bottom of the page at all times. Any ideas? Thanks in advance. Using mysql and php I gather data belonging to different people and I put together one page for each person. The bottom of each page has a different footer: Quote: <div id="footer">Data...</div> The declaration of style is Quote: <style type="text/css"> #footer { position: fixed; width: 100%; height: 180px; top: auto; right: 0; bottom: 0; left: 0; } </style> The problem is that each page has the same information shown at the bottom. However if I check the source code it shows different data for each bottom of page. Help! Hi everyone, I'm having some trouble positioning this footer to the bottom of the page. I'd like for the footer box to display directly under the content/navigation bar, with a gap of four pixels between the respective boxes. In action: http://www.stabhead.com/css/index.html Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN"> <html> <head> <title>Layout</title> <style type="text/css"> <!-- body { background-color: #FFFFFF; color: blue; text-align: center; margin: 5px 0px 0px 0px; } #container { position: relative; width: 981px; border: 0; padding: 0; margin: 0; text-align: left; } #topbar { position: absolute; width: 981px; height: 95px; top: 0px; background-color: #DDDDDD; } #loginbox { position: absolute; width: 249px; height: 92px; top: 97px; background-color: #FFBD72; } #adbar { position: absolute; top: 97px; left: 251px; width: 730px; height: 92px; background-color: #949494; } #navbar { position: absolute; top: 193px; left: 0px; width: 117px; background-color: #DDDDDD; } #content { position: absolute; top: 193px; left: 121px; width: 860px; background-color: #DDDDDD; } #footer { position: absolute; bottom: 0px; width: 100%; height: 64px; background-color: #DDDDDD; } --> </style> </head> <body marginheight="0" marginwidth="0"> <div align="center"> <div id="container"> <div id="topbar">topbar</div> <div id="loginbox">loginbox</div> <div id="adbar">adbar</div> <div id="navbar">navbar</div> <div id="content">content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR>content<BR> </div> </div> </div> <div id="footer">footer</div> </body> </html> The content may consist of something that is 500 pixels in height, or 10,000 pixels - it totally depends on how many words or images are in there, so the footer needs to grip on to the bottom of the content and stretch across the whole of the bottom of the page. If anyone could help me out here, it would be greatly appreciated. http://wdcb.org/newsite/ Having some difficulty here in putting the footer at the bottom of the page. I've looked at dozens of help tools, and none of them work. I'm obviously missing something. Page code: Code: <html> <body> <div id="header"> <?php include('includes/menu_new.inc'); ?> </div> <div id="leftcol"> <div class="element"> <img alt="" src="../images/buttons/PledgeNow.jpg"> <p>This is what text underneath would look like. I know that some of our boxes on the right side can do this so we want to make sure it looks right.</p> </div> <div class="element"> <b>PLEDGE NOW</b> </div> <div class="element"> <b>PLEDGE NOW</b> </div> </div> <div id="content">Content Section dfsdf dfdf fsdf dfsdf sdfsd ghh ghgh hghtr ytgdf gfdfgdf </div> <div id="rightcol"> <div class="element"> <a href="http://iRockJazz.com/" target="_blank"><img alt="" border=0 src="../images/ads/iRJ_wdcb_tile_199pix.jpg"></a> </div> <div class="element"> <img alt="" src="../images/mini-headers/MiniHeader-FolkRoots.jpg" width="200"> <p> Our days may be dedicated to jazz, but during the evenings it's all about the folk! WDCB plays more folk and acoustic roots music than any other station in Northern Illinois. <br><br> <a href="programming/progfolkroot.php">Click here</a> to learn more. </p> </div> </div> <div id="footer"> <?php include('includes/footer.inc'); ?> </div> </body> </html> CSS code: Code: #header { position: absolute; top: 5px; left: 5px; width: 1000px; height: 182px; } #leftcol { background: #f00; position: absolute; top: 187px; left: 0px; width: 235px; } #leftcol .element { margin-bottom:15px; } #leftcol p { margin-left:5px; } #content { background: #ccc; position: absolute; top: 187px; left: 250px; width: 540px; } #rightcol { background: #f00; position: absolute; top: 187px; left: 800px; width: 200px; } #rightcol .element { margin-bottom:15px; } #rightcol p { margin-left:5px; } #footer { position:fixed; bottom:0px; width:1000px; height:100px; background:#005288; } Thank you in advance for your help. Hi all, I am in the early stages of developing a new website and really cant understand why there is a space between the browser window and the container div. Here is the code I have used: html, body { padding: 0; margin: 0; background-color: #D3D3D3; font-family: Arial, Helvetica, Verdana, Sans-serif; font-size: 14px; color: #000000; } #page-container { margin-top: 0; margin-left: auto; margin-right: auto; padding: 0; background-image:url('back.jpg'); background-repeat:repeat-y; text-align: center; width: 800px; } I have tried all sorts of variations but nothing will get the page-contaner div to go flush with the top and bottom of the browser window! (I have used this code many times before and it always works, even sites I have stored locally on my machine using this look fine?!?!?) Any help would be greatly appreciated! Rich i tried searching for this and wasn't able to find any threads. i have a container div with my content, and then i have a footer div that i want to always be at the bottom of the page. i've got it to work in FireFox, but IE is a pain as usual. can anyone look at this and tell me if i'm doing it right and/or what i'm doing wrong? thx. css Code: #container {min-height: 87%; width:620px; margin: 30px auto; position:relative; text-align: center; clear: both; background-image: url(images/backgroundCol.gif); background-repeat: repeat-y;} #container_footer { margin:auto; height:50px; width:620px; text-align:center; background:#FF0000; clear:both; position:relative; margin-top: -80px; clear: both; background-image: url(images/footerBackground.gif); background-repeat: repeat-y;} html Code: <div id="container"> container <br class="clearall" /> </div> <div id="container_footer"> this is the footer <br class="clearall" /> </div> here is the page in action so far http://www.photography139.com/index.html I'm using CSS to create a gradient, and all is well except for the bottom of the page: http://www.area51entertainment.co/gradient_problem.png For some reason it's placing a red bar at the bottom of the gradient. Any ideas why? http://www.area51entertainment.co/index.php EDIT: Fixed using the following: Code: background-repeat: no-repeat; background-attachment: fixed; I've made a site for someone and it was center aligning and it worked in all 3 main browsers (IE, FF and Opera) so when I was tinkering with ideas for redoing the look of my site, I used the CSS sheet I used for his site as a base for mine. Unfortunately it's only center align in IE7 with my site. My site is admittedly a bit more complex, at the moment, with more divs, it should still work. Mind you I'm probably just too tired to spot the obvious. Can anyone see what's stopping it from center aligning in FF and Opera? The template: http://www.toadwarrior.com/temp/index.php The CSS: http://www.toadwarrior.com/temp/mark_h_walker_journalist.css Thank you in advance. Hi I'm trying to set an element at the bottom of the page, but I'm having a little bit of problems with this. I have to following element Code: <style> #footer { height: 30px; border-top: solid 1px #000000; background-color: #eeeeee; } </style> <div id="footer"> Hello world </div> This element should be at the bottom of the page - always. Let's say that the page content's height is 100px. The footer should be placed at the bottom of the page, just above the status bar in the browser. If the page content is longer than the screen resolution (in other words, you'll have to scroll), then the footer will again be placed at the bottom of the page, BUT it will not be visible untill you scroll down - in other words, it's not a layer that is floating above the status bar. Do you have any ideas how this could be done? I tried position: relative; bottom: 30px; but that only placed the footer 30px from the bottom of the content. So if the content ended at 100px, then the footer started at 70px. Can this be done with css or do I have to use javascript? - Kimppa |