CSS - How To: Make A Page Size Based On Content
i have a base page that i use for a multi-page site, but i'd like to be able to insert more and more content, and have the page size accordingly. i think the problem is that the content is technically floating...or something, it's a cold fusion search result in a cart. i don't know, i might be asking for a miracle here- if you have an idea, let me know.
Similar TutorialsHello everyone! my apologies if this is a dumb/old question - I did a search but didn't find anything like this... Question is, how can I make a page within an Iframe inherit the parent pages css? Reason is, I have a site with a css switcher (using php - a copy and paste job, still learning!) that uses iframes. Or would I be better ditching the iframes and using hidable DIV's? cheers guys! Hey everyone. I have a parent div that I write to using javascripts innerHTML. It works fine for text and <p>'s and stuff, but if I fill it with other div's it doesn't grow accordingly... For example this would work... <div id="parentDiv"> <p>this parentDiv div would grow and grow as i add more stuff</p> </div> This next example doesn't seem to work.... <div id="parentDiv"> <div id="childDiv"> <p>why won't parentDiv grow as its childDiv grows!!?!?!?</p> </div> </div> Should this work? Thoughts? What is the best way to make compatble text size between browser? I have a div with a width of 300px, I pasted some text in it, it appears identical with firefox, chrome and safari (the letters are the exact same place), but when it comes to IE 8 (probably 6/7 too), the text is not displayed at the same place. the contents of a div have an undetermined size, it varies. I need to vertically center it as well as horizontally, which I can do the latter of. I can't use padding or margins because I don't know the size. How do I do this? Hi friends, all good? It was wanting to make an equal thing of the image that I am placing To place option with these properties of the source and the size. Somebody would know as to make this? Sorry my English Thanks Hi, Can anyone recommend how best to how to dynamically constrain amount of Text/Content in a DIV area that can vary in size?? That is, say you have: (a) a content (DIV) area on your view that can expand/contract depending upon browser size ( i.e. when someone is re-sizing the browser window) and (b) dynamic text/content that is to be displayed, based upon user input - e.g. image a defined area/size for several user comments for example. Users can create their own comments, but you only want them to be able to take up a given amount of screen resource, and then perhaps have a "...more" link at the bottom if they go over. How can I best setup this up? e.g. (1) How to setup the layout/CSS so that if more text / content is present in the DIV area that can be displayed that the DIV area doesn't expand due to the extra content the user put forward, and/or (2) Do I need to also complete this by programming what content comes out? E.g. in Ruby on Rails say then the question would be how to calculate how much text/content can fit in the current size of the DIV (noting browser re-sizing) so that you get the chance to put the "...more" link at the bottom? Hopefully this approach isn't required. Any other suggestions welcome that address what I'm trying to do are welcome, which is really offering a area for display of user feedback where each piece of feedback has a maximum area it can take on the main screen only, and also that browser re-sizing is possible. Tks Greg When content exceeds the window size, the fixed footer covers it. The center div has a min-width, the right div covers it when the window is resized to smaller than the min. (Also, center div drops in IE). I have googled these issues and searched the archives. I've tried many different techniques for getting these things in order, and this is the closest I've gotten so far. What I want: 1.A footer that sticks to the bottom of the viewport if there is not enough content AND stays below the container when the container is longer than the viewport. 2. The center div to be liquid with a min-fixed width and the right div to move along the edge of the center div and not cover it when viewport is sized smaller than the center div's min width. Here is a simplified version of the HTML (none of the extra divs that are used to make rounded corners) Code: <!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=iso-8859-1" /> <title>Troubleshooting</title> <link rel="stylesheet" href="layout8.css" type="text/css" /> <link rel="stylesheet" href="round.css" type="text/css" /> </head> <body> <div id="header"> <div id="masthead"></div> <div id="topnav"><div class="searchbar">Search</div> <div class="homebar"><span>Home </span></div></div> </div> <div id="container"> <div id="left"></div> <div id="right"></div> <div id="content"></div> </div> <div class="clear"> </div> </div> <div id="footer"></div> </body> </html> I think there's too much CSS to post here, but everything can be found at: www. observera. com/troubleshootingpage/index. htm CSS @ layout.css and round.css I appreciate any help you can offer Em if you didnt understand the subject i'll try and explain it a bit better here! This is my problem in IE my page looks like this http://www.readyflowers.com.au/div-fill.gif But what i want is when there is no content for those divs not to appear so it would look like this (In firefox it works!) http://www.readyflowers.com.au/div-fill-firefox.gif I've looked over a couple of answers and they didn't seem to help me. I have a css "container" box defined like so, containing another "content" box. I'd like the container's height to stretch to contain whatever is in the content box. #container { width: 720px; height:????????????????; margin: auto; text-align: left; position: relative; } #content { position: relative; left:125px; top: 105px; width:500px; border:0px solid #000; } with html like so: <div id="container"> <div id="content"> </div> </div> The content always spills over, unless I set overflow, but that does not solve the problem. Quick nagging question that's been bothering me for some time. Fortunately, I have a link to explain the problem. If you go to our web page (link below), you will see that we have a DIV section on the left side of the page which displays a mini You Tube video, along with a few other buttons: http://bit.ly/gL9sA8 The problem is that when you shrink the window, that particular div will shy away outside the bounds of the browser window. Is there anyway to not have it disappear, but at the same time, not have the main content overlap it in anyway. In other words, how would you code the DIV tag so that the following two things happen: 1. It's always in view on the LEFT side of the webpage 2. The main DIV stops against it, and doesn't overlap it if resized As you can see, if you shrink the size of the window, our main div area (div id: mainWrapper) is always going to be centered which is the most important thing. However, we want to have a left (or right) side area to display buttons like that. Here is the current code for that left sided DIV column: Code: <div style="position:fixed; margin-left: -180px; top: 75px;"> // My html content for mini You Tube video & button is here </div> The problem is that if a person has a low resolution monitor, this left hand div is out of view and never seen.....or even worse, it's partially seen and not fully displayed because it's hiding outside the bounds of the window. My goal: To have it fixed to either the outer LEFT or RIGHT side of the webpage, just along the edge of the mainWrapper as you see it now. If I can clear anything up as to what I'm trying to explain, please let me know. I hope one of you awesome gurus can point me in the right direction! Hi, I have a content box inside a layer in Dreamweaver and I want to be able to align this content box to the right hand side of the layer, rather than on the left side. Is it possible to do this? Here is the code: Code: <head> <style type="text/css"> .xsnazzy h1 { margin:0; font-size:1.2em; padding:0 10px 5px 10px; border-bottom:1px solid #d76f0a; } .xsnazzy p { margin:0; padding:5px 10px; font-size:10px; } .xsnazzy { background:transparent; width:180px; float:left; margin-right:10px; } .xtop, .xbottom { display:block; background:transparent; font-size:1px; } .xb1, .xb2, .xb3, .xb4 { display:block; overflow:hidden; } .xb1, .xb2, .xb3 { height:1px; } .xb2, .xb3, .xb4 { background:#fff; border-left:1px solid #d76f0a; border-right:1px solid #d76f0a; } .xb1 { margin:0 4px; background:#d76f0a; } .xb2 { margin:0 3px; border-width:0 1px; } .xb3 { margin:0 2px; } .xb4 { height:2px; margin:0 1px; } .xboxcontent { display:block; background:#fff; border:0 solid #d76f0a; border-width:0 1px; } .color_a { background:#f69b43; color:#fff; } .color_b { background:#d76f0a; color:#000; } .color_c { background:#758279; color:#fff; } </style> </head> <body> <div id="Layer9" style="position:absolute; width:176px; height:115px; z-index:8; left: 332px; top: 157px;"> <div align="center" class="xsnazzy"> <b class="xtop"><b class="xb1"></b><b class="xb2 color_a"> </b><b class="xb3 color_a"></b><b class="xb4 color_a"></b></b> <div align="center" class="xboxcontent"> <h1 align="center" class="color_a"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Shopping Basket</font></h1> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> </div> <b class="xbottom"><b class="xb4"></b><b class="xb3"></b> <b class="xb2"></b><b class="xb1"></b></b> </div> </div> </body> Ok, I have basic CSS knowledge but need some help. Here's what I'd like to do: I take trips and post pictures on my site. I use lighthouse to display the images, so each image has a separate filename and caption, and each group of images has a separate group name. Under "Ski Trip", for instance, I'll have Img 1, "Skiing"; Img 2, "More skiing"; etc. It's relatively tedious to create page after page that uses the same format. I use CSS for style, the menu, and Lighthouse, but is there way that I could create a new page entitled "New ski trip.html" and in that file just have a list of the image filenames, captions, etc., that end up all using the same html format to display the images? I don't think I'm being terribly clear (sorry) ... big kudos to anyone who can help. CSS newb here and this is my first full CSS page layout ever, so go easy. Some of the page elements do not stretch properly to match the page content. I also tried to add a few bits to make a sticky footer, and in doing so I sort of confused myself as to where the problem is. Here's a link to the page: http://www.crackin.com/cbled/index.html and here's the code: Code: body {font: 75% Verdana, Arial, Helvetica, sans-serif;background: #FFFFFF;margin: 0;padding: 0;text-align: center;color: #000000;height: 100%;} html {height: 100%;} * html #nonFooter {height: 100%;} .oneColFixCtr #nonFooter {width: 923px;background: #FFFFFF;margin: 0 auto;border: none;text-align: left;position: relative;min-height: 100%;z-index:3;} .oneColFixCtr #content {padding: 0 0 56 0; height:auto;} #mainlayout {position:relative;left:0px;top:0px;width:923px;} #liberty-header {position:absolute;left:231px;top:0px;width:114px;height:151px;} #logo-orb {position:absolute;left:0px;top:24px;width:231px;height:156px;} #header-slogan {position:absolute;left:231px;top:151px;width:692px;height:29px;} #logo-ledind {position:absolute;left:0px;top:180px;width:231px;height:66px;} #header-breaktop {position:absolute;left:231px;top:180px;width:692px;height:66px;} #header-breakbase {position:absolute;left:0px;top:246px;width:923px;height:57px;} #liberty-main {position:absolute;left:211px;top:303px;width:366px;height:409px;} #navbarbreak {position:absolute;left:231px;margin-top:10px;width:2px;height:95%;background-color:#BBB; z-index:2;} #pagecontent {position:absolute;left:253px;top:303px;width:650px;height:10px;} #navbar {position:absolute;left:0px;top:303px;width:233px;height:350px;} #navbar-home {float:left;margin-top:15px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar-info {float:left;margin-top:5px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar-link3 {float:left;margin-top:5px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar-link4 {float:left;margin-top:5px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar a {display:block;width:100%;height:100%;text-decoration:none;color:#333;background-color:#EEE;padding:4px 0px;} #navbar a:hover {background-color:#9ADF86;} #footer {position:relative;width: 923px;margin: -56px auto 0 auto;z-index:4;} #footer-left {position:absolute;left:31px;top:0px;width:18px;height:56px;} #footer-bg {position:absolute;left:49px;top:0px;width:825px;height:56px;background-color:#329428} #footer-right {position:absolute;left:874px;top:0px;width:18px;height:56px;} #greenbreak-z {z-index:1;} #greenbreak {position:absolute;left:0px;top:200px;width:100%;height:123px;background:url(images/mainbg_horiz.jpg);background-repeat:repeat-x;} #page-edges-a {position:absolute;left:0;top:0;width:100%;height:100%;z-index:2;} #page-edges-b {position:relative;margin:0 auto;width:923px;height:100%;} #mainbg-leftvert {position:absolute;left:-16px;top:0px;width:16px;height:100%;background:url(images/mainbg_leftvert.png);background-repeat:repeat-y;} #mainbg-rightvert {position:absolute;left:923px;top:0px;width:16px;height:100%;background:url(images/mainbg_rightvert.png);background-repeat:repeat-y;} #clear {clear:both;} --> </style></head> <body class="oneColFixCtr"> <div id="nonFooter"> <div id="content"> <div id="mainlayout"> <div id="liberty-header"><img src="images/liberty_header.jpg" width="114" height="151" alt=""></div> <div id="logo-orb"><img src="images/logo_orb.jpg" width="231" height="156" alt=""></div> <div id="header-slogan"><img src="images/header_slogan.png" width="692" height="29" alt=""></div> <div id="logo-ledind"><img src="images/logo_ledind.jpg" width="231" height="66" alt=""></div> <div id="header-breaktop"><img src="images/header_breaktop.jpg" width="692" height="66" alt=""></div> <div id="header-breakbase"><img src="images/header_breakbase.jpg" width="923" height="57" alt=""></div> <div id="liberty-main"><img src="images/liberty_main.jpg" width="366" height="409" alt=""></div> <div id="navbar"> <div id="navbar-home"><a href="#">home </a></div> <div id="navbar-info"><a href="#">company info </a></div> <div id="navbar-link3"><a href="#">link3 </a></div> <div id="navbar-link4"><a href="#">link4 </a></div> <div id="navbarbreak"></div> </div> <div id="pagecontent" align="justify"> <p>Lorem ipsum, etc etc...</p> </div> </div> </div> </div> <!--PAGE DROPSHADOW--> <div id="page-edges-a"> <div id="page-edges-b"> <div id="mainbg-leftvert"></div> <div id="mainbg-rightvert"></div> </div> </div> <!--GREEN BACKGROUND--> <div id="greenbreak-z"> <div id="greenbreak"></div> </div> <!--FOOTER--> <div id="footer"> <div id="footer-left"><img src="images/footer_left.gif" width="18" height="56" alt=""></div> <div id="footer-bg"></div> <div id="footer-right"><img src="images/footer_right.gif" width="18" height="56" alt=""></div> </div> </body> </html> Any help is much appreciated. I actually have two problems... Installing hte firebug plugin for firefox may ease helping me out... The problem is with http:// kthxbai2u<dot>com I cant for the life of me center the "content" div. I have tried every method I found on the first 4 pages of Google. The only thing I can think of is that it is inheriting something wierd or I am missing something simple... The second problem, I can't seem to make the left and right side bar expand to meet up with the footer wayy down at the bottom of the page. I want that div to make a column the whole way down. If anyone can help me out, it would be more than appreciated! Thanks Hi, My page has 3 elements: one at the top(header banner), one in the middle (a middle content area) and one at the bottom (footer banner). Now I want those positions to remain intact regardless of the number of lines output in the middle element. The content is going to be determined at runtime by a server-side routine so I don't want to use a fixed positioning for the footer banner. I want it to be displayed at the bottom - after the middle content is displayed. And I want the middle content to be visible in the page i.e. I don't want a scroll area within the page. I have tried various approaches and read up on positioning but so far have not been able to do it using css. Any help is much appreciated. Jim Hi everyone, Having some problems with CSS printing. I am trying to get a webpage to print in B4, no print margins, no header or footer. There is supposively a way to do this in CSS with the @page properties. I've tried the examples from the w3c site but to no avail. Does anyone have any code that definitely works for internet explorer? Thanks, Dave. Hi guys, I have a query, im trying to create the effect, that this site has. Quote: http://www.exigeinternational.com/index.htm i mean that the i want to create the effect that that site has when the page is minimised,i want each side to get smaller instead of everything moving to the left. sorry if it sounds confusing. appeciate all help thanks andy Hello: I am building a website for a broad audience. I need there to be an option for text to be resized for those who have trouble with reading screens. I am trying to have the text on HTML pages be changeable through CSS. Two examples I offer are (URL address blocked: See forum rules) and (URL address blocked: See forum rules) On the top right corner of the screen, there are options to change the text size without switching to a new HTML page. I believe this is done using CSS (perhaps Live StyleSheet Selector). I'm not really sure. If anyone can help me, I would really appreciate it. Thanks! Deanna I am trying to copy a pdf, and it is imperitive that the pages match up: page 1 on the pdf is page 1 on the html file when printed and so on. I am using font 12pt sizes. if it prints out correctly on my computer will it print out correctly on all since I am using the pt instead of something relative like <font size=3>? if this will not work for all then does anyone have any recomendations on how to do it? Hi, Here's the site I'm working with: http://www.cjfusion.com I want to get that image centered on the browser window and then depending on how big the viewers screen is, the browser will cover up the left and the right. I hope that makes sense. I almost want it to be fluid, but I'm unsure how to do that. Ask questions if this doesnt make sense. Its hard to explain. -CJ |