CSS - Resizing Content With % Instead Of Px?
Hi there!
I am tweaking a WordPress template to fit a blog for a roleplaying game. The template is a three-column, fixed-width one. It looks fine on my tiny 17" monitor at work, but at home on my 22", the blog is very small and sits in the center of the page. (The content section is just 904px wide.) Is there a way to tweak the style.css file in order to give the columns percentage widths instead of absolute pixel widths, so that the center "content" area will resize properly according to the reader's resolution/monitor size/window size? I have some experience with CSS and I'm usually pretty good at tweaking pre-existing CSS to fit my needs, but this is something that's a bit beyond me. I can't put a direct URL in my post, but here's a snippet of the CSS file: Code: body, h1, h2, h3, h4, h5, h6, address, blockquote, dd, dl, hr, p, form{ margin: 0; padding: 0; } body{ font-family: Arial, Helvetica, Georgia, Sans-Serif; font-size: 12px; text-align: center; vertical-align: top; background: #fff url(); color: #fff; } h1, h2, h3, h4, h5, h6{ font-family: Arial, Helvetica, Georgia, Sans-Serif; font-size: 16px; } a{ text-decoration: underline; color: #08441e; } a:hover{ text-decoration: none; } a img{ border: 0; } abbr, acronym{ border: 0; } address, dl, p{ padding: 10px 0 0; } blockquote{ margin: 10px 10px 0; background: #fffada url(images/bg_blockquote.gif) no-repeat 5px 7px; color: #736926; } blockquote p{ padding: 10px 10px 10px 20px; } blockquote blockquote{ margin: 10px 20px; background: #fff; color: #333; } blockquote blockquote p{ padding: 10px; } code{ background: #f9f9f9; } dt{ font-weight: bold; } dd{ padding: 0 0 5px 15px; } hr{ clear: both; margin: 15px 0 5px; width: 100%; border: 0; height: 1px; text-align: left; background: url(images/bg_comment_bottom.gif) no-repeat; } small{ font-size: 10px; } input, textarea{ font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; padding: 2px; } input#author, input#email, input#url, textarea#comment{ border: 1px solid #cbb945; background-color: #fffadb; padding: 3px; } input#author, input#email, input#url{ margin: 0 5px 0 0; } #container, #header, #menu, #menu ul li, #menu ul li a, #pagetitle, h1, #syndication, .pagewrapper, .page, .wrapper, .narrowcolumnwrapper, .narrowcolumn, .content, .post, .entry, .browse, sidebar{ text-align: left; vertical-align: top; } #container{ margin: 0 auto; width: 904px; padding: 10px 0 0; } #header{ margin: 0 0 10px; float: left; width: 904px; height: 250px; background: url(images/bg_header.gif) no-repeat left bottom; color: #333; } #menu ul{ margin: 0; padding: 0 0 0 175px; list-style: none; } #menu ul li{ float: left; margin: 0 5px 0 0; font-size: 14px; font-weight: bold; background: url(images/bg_tab_right.gif) no-repeat right top; color: #ffffff; } #menu ul li a{ display: block; padding: 14px 20px 10px; text-decoration: none; background: url(images/bg_tab_left.gif) no-repeat left top; color: #ffffff; } #menu ul li a:hover{ text-decoration: underline; } #pagetitle{ clear: both; width: 904px; height: 250px; } } #pagetitle h1 a{ text-decoration: none; color: #fff; } .pagewrapper{ margin: 0 0 10px; float: left; width: 904px; background: #fff url(images/bg_page_bottom.gif) no-repeat left bottom; color: #333; } .page{ float: left; padding: 0 5px 5px; background: url(images/bg_page_top.gif) no-repeat; } .wrapper{ /* This wrapper class appears only on Page and Single Post pages. */ float: left; width: 500px; } .narrowcolumnwrapper{ margin: 5px 0 0; float: left; width: 500px; background: #fff url(images/bg_narrowcol.gif) repeat-y; } .narrowcolumn{ float: left; width: 500px; background: url(images/bg_narrowcol_bottom.gif) no-repeat left bottom; } .content{ float: left; width: 500px; background: url(images/bg_narrowcol_top.gif) no-repeat left top; } Thank you! Similar TutorialsI have tried multiple times to have a kind of "content" div, where it resizes vertically to the amount of content in it, and stays the same width and is centered. How can I do this? I know min-height doesn't work in IE. Another problem I was having, certain pages would be off to the left when they should have been centered. Please help! Hi, I've been trying for a while to get to grips with this css lark, but i find some of it really confusing, not being able to make sites that look the same in all browsers without using tables. So here I arrive at my latest problem. I have made a static site, where resizing the browser doesn't adjust the size of the content. In my logic this ought to mean that scroll bars should appear when the content is bigger than the window, but oh no, everything is just hidden! Am I missing a vital trick here? The code: Code: <div class="title"> <img src="face.jpg" alt="Picture" width="75" height="75" /> <img src="title.jpg" alt="Title" width="300" height="88" /> </div> CSS: Code: .title { position: fixed; left: 10px; top: 15px; width: 375px; height: auto; } Just to clarify: When, with the code above, the browser is resized to be small than the width of the div, I expect scroll bars to appear to be able to see the content, but currently it is just hidden. Can anyone help me? Thanks in advance Hi there, I have a content glider script, but I have added it to a wrapper with a background image. The css is using a white background colour so when a new layer is glided up, it covers the one underneath it. However, I want the background to be transparent to show the background image underneath.... If I remove the white background, they layers become transparent and overlay each other, so you can see all text in the layers on top of each other making it impossible to read. Is there anyway I can make it so it has a transparent background, but so it will not show the content under the new slide? This is my CSS: PHP Code: .glidecontentwrapper{ position: relative; /* Do not change this value */ height: 230px; /* Set height to be able to contain height of largest content shown*/ overflow: hidden; } /* Total wrapper width: 350px+5px+5px=360px Or width of wrapper div itself plus any left and right CSS border and padding Adjust related containers below according to comments */ .glidecontent{ /*style for each glide content DIV within wrapper.*/ position: absolute; /* Do not change this value */ background: white; visibility: hidden; width: 330px; } /* Total glidecontent width: 330px+10px+10px=350px Or width of wrapper div itself (not counting wrapper border/padding) */ .glidecontenttoggler{ /*style for DIV used to contain toggler links. */ width: 360px; margin-top: 6px; text-align: center; /*How to align pagination links: "left", "center", or "right" background: white; /*always declare an explicit background color for fade effect to properly render in IE*/ } Any help would be great! Thanks. I have been asked to create a font resize on a website. I can do the basics of it but I'm running into a couple snags Question 1 In my stylesheet, I have: Code: #centerCol { float: left; color: #333; font-size: 10px; padding: 10px 10px 10px 15px; } And in my code I have a function that contains: Code: document.getElementById('centerCol').style.fontSize = '12px'; It works fine to resize the centerCol ID but what if I want to only resize the <p> tags in the centerCol ID? Question 2 Is there a way to resize without the use of Javascript? Everything I've found so far includes it. Hey people. I've been desperatly searching for a fix for the bug in my CSS, but I don't know what I'm doing wrong. Here is a link to the the testfile: http://users.skynet.be/bert_fonteyn...iek/index.html. The page validates as valid XHTML. Now here is the bug in Windows (I have not tested it in Mac yet), both in Netscape 7 as in IE 6. Shrink your window, so you have a horizontal scrollbar. Scroll to the right, and you will notice there is a white area which can 't show the backgroundtile for some 60 px wide. The content (which is white) is there however... Can someone please tell me what I'm doing wrong? Greetz, Bert Here is the code for what is basically the masthead for the top of a web page. It uses tables, and expands and contracts to fit the browser as the viewer re-sizes. Quote: <table width="100%"> <tr> <td><IMG src="images/banner_left_end.gif"></td> <td width="100%" background="images/some_background.gif" align="middle" valign="center"> <!-- middle cell at 100% to push the left and right cells to the browser edges --> </td> <td><IMG src="images/banner_right_end.gif"></td> </tr> </table> What I would like to do is get rid of the table and use DIV tags and CSS to do this, but I'm having trouble figuring out how to push the left image to the left and the right image to the right to make it grow and contract as the browser re-sizes. How is this done? Alright, this seems to be tricky, but here's the story: I've got a photography gallery I made for a friend, and the last thing that needs to be taken care of is cross-browser compatability. I'm down to one problem of image resizing for thumbnails in IE. I've seen a few solutions, but none of them seem to work, so maybe I'm just doing things wrong, but then again no site has talked about resizing both horiz. and vert. For the site, any image thrown on the page needs to be resized to no greater then 105x100. But please, don't tell me to use PHP for this - I'm very attached to the fact that the entire site weighs in at under 300 lines. Thanks, Brian Ziemek hello people, im stuck. i have a simple layout in html, it works fine in html but when i try to use css to layout the page i cant get the centre cell to resize while the top and bottom don't. here is my html page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td height="52" bgcolor="#009999"> </td> </tr> <tr> <td bgcolor="#FF9933"> </td> </tr> <tr> <td height="52" bgcolor="#009999"> </td> </tr> </table> </body> </html> can anyone help? can css do this? Paul Sully the stuck Anyone know how to get your website's background to resize as the page is manually resized when using IE? It resizes properly on both on mac and PC using Firefox, Safari, and Opera, but not IE (on PC). Thanks I fixed it on my own, thanks for the multitude of responses, not. I'm looking to basically replicate the design of Engadget. Not entirely, just the real basic design of it. I'm trying to figure out how to use 4 different images (a right header, left header, left footer, right footer) to construct a site that resizes in different browsers to look good. How do I do this? I'm familiar with CSS and html. I want to make the images in Fireworks and slice them, but after I do that and have the html how do I do things like using a wrapper? Thanks for any help you can offer. I have a div centered in the middle of my page if i type a long paragraph between the two <div> tags it is all one line, and resizes the div, even though i have its width set to a fixed size? is there something im doing wrong? Im completely stumped thanks in advance Hi, is there any way to achieve this effect (pseudocode) with CSS? if (image width > 100) add property width="100" to all img tags ie. i want to make all images larger than 100 pixels scale down http://hmv.co.in/temp/html/boxes.html when the content of the box of either left and right boxes in the above page is diff... the boxes margin is also changed... how can i make both the boxes of the same siz so tht theres blank space in the box tht has less content I have attached the file, If you Open a File using that, the Textarea was styled to go to 90% (<textarea style="width:100%;height:90%;"></textarea>) this is designed only to work in IE! Can someone please help me? Thank you, In advance Zero Sup all. Im trying to make a website but it keeps resizing when I expand and retract me webbrowser. So Far this is my code PHP 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=utf-8" /> <title>Free UFC PPV</title> <style type="text/css"> body { background-color: #CCC; font-family: Tahoma; } #holder { width: 75%; padding: 10px; border: 1px solid; text-align: left; } #img{ background-image:url(images/header.png); } #login { width: 100%; font-family: Tahoma; font-size:15px; text-align: right; color: Black; border: 1px solid; } </style> </head> <body> <center> <div id="holder" style="width:75%"> <a href="index.php"> <img src="images/header.png" alt="Header Image" width="1024" height="150" /></a> <div id="login" style="100%" > <form action=""> Login:<input name="userlog" type="text" /> Password:<input name="passlog" type="text" /> <input name="btn_sub" type="button" value="Login" /> </form> </div> </div> </center> </body> </html> What can I do to stop resizing? I need to add a background picture to my web form. I want that the picture should be dynamically resized to the client area of the browser, when the page loads How to do it using CSS? All right, so I am not new to programming of any sort, but I am fairly new to using CSS to construct a layout without tables of any sort. I am having a little problem with my layout. I have a parent div element that is acting as a container for other div elements. Right now the layout is just a wireframe so I can easily get everything set so I can continue building. Each element has a border so they can be easily seen. It is he http://www.thewellofdreams.com/wodtest/ The CSS Code used: Code: body { text-align: center; background-color: #FFFFFF; } #Container { text-align: center; margin: 0px auto; border: #000000 1px solid; min-height: 700px; height: expression(this.scrollHeight < 700? "600px" : "auto" ); /*border-top: none; border-bottom: none; border-left: none; border-right: none;*/ position: relative; width: 800px; } #Top { left: 50px; top: 50px; width: 700px; height: 25px; position: absolute; border: #000000 1px solid; /*border-top: none; border-bottom: none; border-left: none; border-right: none;*/ text-align: center; } #Content { top: 78px; left: 50px; min-height: 600px; height: expression(this.scrollHeight < 600? "600px" : "auto" ); width: 700px; border: #000000 1px ridge; /*border-top: none; border-bottom: none;*/ position: absolute; text-align: left; font: italic 14px arial; } The HTML Source: 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" /> <link rel="stylesheet" href="css/basestyle.css" /> <link rel="stylesheet" href="css/.css" /> <title>Well of Dreams</title> </head> <body> <div id = "Container"> <div id = "Top"> </div><!-- End Top --> <div id = "Content"> (Note: this area is filled by a PHP statement that just spits out the same word over and over again to expand the div tag. Eventually content will fill this space.) </div><!-- End Content --> </div><!-- End Container --> </body> </html> I have looked all over the internet for a solution but it seems that every tutorial I can find is concerned with the child elements resizing to fill the parent element, not the other way around which is what I am looking for here. Anyone got any ideas? |