CSS - Window Resize
Hi,
I am using html and css to design a website. My problem is that when I resize the web browser, all of the elements reposition themselves accordingly. Is there some to keep them all fixed in position? Thanks! Similar TutorialsHello, I have a menu to the right and the main content is on the left. When I resize the window the content drops below the menu. Is there anyway to stop this from happening? [Do you need to see code?] Cheers Hey guys. I have a layout designed right now that has, in brief, a wrapper around my main content and then a left and right float(both floated left). My wrapper of the whole site is just set to a margin of 30px on the right and left, meaning it doesn't have a set width. My left float is a column, and is set to a width of 220px. Then, whenever I add content to my right side, it will stay there until it goes over a certain amount, and then it will break and go below the left float. I have used the clearfix method on the main container float, and I really don't know where to turn now. Here are the styles for my main container, left, and right floats: Code: #content { background: #fff; padding: 0 10px; padding-top: 5px; /* This division also has the .clearfix class */ } #left { float: left; width: 220px; border-right: 2px solid #ccc; } #right { float: left; padding: 0; margin-left: 10px; font-size: 1.2em; /* This is the Div that drops after too much content */ } I would like it so that the content in the right div will adjust when the window is resized, but it won't break to the line under the left float. I know this is an easy fix, I just don't know it. Basically I have a vertically that spans the top of my page, but if the window is too small or resized too small, the menu is broken into two parts, the part that doesn't fit the menu forms a new line. How can this be fixed? Much thanks! Here's the site with the issue: http://www.entertainmentengineering.com/v6.issue1/ Reply With Quote Can it be done with just CSS? I have a table of data where the text in the data cells wraps and fills the td cell with several lines of text. This is OK when the browser window is a "normal" size, but if someone is viewing with a widescreen monitor I would like the table to get wider and make the cell contents not wrap the text. Or if they are viewing with a small monitor I want it to wrap even more (table would get smaller). Can this be done with CSS, or do I need to do something with javascript? works in FireFox, page looks the same no matter how u resize the window: http://img63.imageshack.us/img63/3264/firefoxview.png looks bad in IE: http://img63.imageshack.us/img63/8986/ieview.png css: Code: body { height: 100%; width: 100%; margin: 0; padding: 0; } #content { height: 100%; width: 100%; position:absolute; z-index:2; } img#bg { width:100%; height:100%; position:absolute; z-index:1; } img#titleimg { width:100%; height:100%;/*new*/ } img#mainmenuimg { text-align:center; width:30%; height:100%;/*new*/ } img#analogskillsimg { width:40%; height:60%; } img#programmingimg { float:right; vertical-align:bottom; width:40%; height:60%; } img#analogskillstext { vertical-align:bottom; width:40%; height:100%;/*new*/ } img#programmingtext { float:right; width:40%; height:100%;/*new*/ } table.introlayout { width:100%; height:100%; } td.introtitle { width:100%; height:10%; } td.skillpics { vertical-align:bottom; width:100%; height:70%; } td.skilltext { vertical-align:top; width:100%; height:10%; } td.menu { text-align:center; width:100%; height:10%; } xhtml: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Patrick Allard's Very Graphic Website</title> <link rel="stylesheet" type="text/css" href="main.css" /> </head> <body> <img src="backgroundfire2.gif" alt="background image" id="bg" /> <div id="content"> <table class="introlayout"> <tr> <td class="introtitle"> <img src="titlemaxfontgreyredfire.gif" alt="background image" id="titleimg" /> </td> </tr> <tr> <td class="skillpics"> <img src="analogskillspic.jpg" alt="background image" id="analogskillsimg" /> <img src="programmingpic.jpg" alt="background image" id="programmingimg" /> </td> </tr> <td class="skilltext"> <img src="analogskillsmaxfontblackbluefire.gif" alt="background image" id="analogskillstext" /> <img src="programmingmaxfontblackbluefire.gif" alt="background image" id="programmingtext" /> </td> </tr> <td class="menu"> <img src="mainmenumaxfontblackbluefire.gif" alt="background image" id="mainmenuimg" /> </td> </tr> </table> </div> </body> </html> When I resize the browser window on this page, the text "onclick" and the Cart and Search text stay in one place while the other text and background move. Why is this happening, I need everything to move together. This only seems to be happening IE, FF and Chrome seem fine. http://makethemoviehappen.com/darix.html I have just moved to working with layers as opposed tables/cells. Previously i had a table with three cells, at 86%, 4%, and 16% widths so it spanned the screen. The first cell's content only partly fills the cell, so when the browser is resized (made smaller), each cell stays on the same line and the table happily resize to the point where it can no longer get smaller before it wraps text I have tried to replicate this using 3 div's of the same width as the cells, with float left, however, the browser can hardly be resized at all from full screen without the third div moving onto the next line. If i make the 2nd and third divs larger it works slightly better, however the content does not look right in the layers Therefore can anyone point out how i might be able to achieve better DIV resize when the browser resizes please. Thanks very much Ed Hi all, I am trying to replace the frames with CSS on my tree menu page. Was just wondering if it is possible to bring the resize funcationality to the menu as I had in frames (i.e, user could menually resize the frame if required) OR mayb some auto fit- content solution i.e the pane would automatically grow if possible. Thanks, Sameer. I want to have a web page with a list on it that dynamically resizes to fit the browser viewport with a minimum distance between list items. Here's an example I faked in TextPad: Normal view: User enlarges browser: User shrinks browser: How would I accomplish this in HTML/CSS? Thanks! Hi I am rather novice at CSS and what it can do but thought I would see if anyone can offer any feedback. I have been asked to resize the following website: http://www.Ihaveone.org Currently it takes up a third of the window and it is requested to take up the whole window. Is there an easy way to do this? I have downloaded all the files to Adobe GoLive, but am unclear if or how this can be done without redesigning the entire site. Please, any help is greatly appreciated! bufhal hi all, i'm doing a content management system front end form that worked perfectly until i tried the last bit of debugging and found that when resizing the browser it distorted the page... is there a way around this? im fairly new to CSS and have been using relative positioning for my divs. i thought it was easy but i cant seem to get a div fit the space it has on my page like.....the size of my page depend on 1 table...the div has to grow till the bottom of that table if i put 100% in the div and things it grows too big maybe im forgetting something I have the following situation: I have a scrolling table, split in two divs. One div contains the header table with column headers, and the data div contains the actual data table. Both divs are fixed in height, but what I would like to do is have the data div resize depending on the number of rows in the data table. I have tried playing with divs' min-height and max-height and these seem to work fine for IE7, FF2 and Safari, but not for IE6 and Opera. Is there any workaround that would be compatible with all mentioned browsers? Thanks! Hello I need to display an image as a background for a table cell I am using the style background-image and it is working fine Here is my problem My table cell has a specific width of 100 pixels The image that I need to display may have a width greater than 100. Is there a way to tell the browser to resize the image to width of 100 pixels and then to display it as a background image? Currently, it just displays the first 100 pixels of the image inside the cell and the rest of the pixels are cut off I must use a background image (background-image) and not an image tag (img) regards Found lots of similar threads, but not exactly the same problem... Any ideas how I can get the main content to stay centered along with the background on my site: http://gumbald.co.uk It works fine in FF, but not in IE, so I'm guessing it's a CSS issue My CSS: Code: /*Default CSS file*/ /*Formats <html> tag*/ html { height: 100%; overflow: -moz-scrollbars-vertical; background-color: #BBF; } * html #wrap { height: 100%; } /*Formats links to set colors, actions*/ #wrap a:link { color: #0054A6; text-decoration: none; } #wrap a:visited { color: #0054A6; text-decoration: none; } #wrap a:hover { color: #828282; text-decoration: none; } #wrap a:active { color: #000000; text-decoration: none; } /*Formats <body> tag*/ body { font: 65% 'trebuchet ms', arial, helvetica, sans-serif; min-height: 100%; width: 640px; margin: auto; padding: 0; background-color: #FFFFFF; border: 0px solid red; } /*Formats <h1> tag*/ h1 { font: 300% 'trebuchet ms', Arial, Helvetica, sans-serif; color: #00f; padding-top: 0px; margin: 0; } h2 { font: 130% 'trebuchet ms', Arial, Helvetica, sans-serif; padding-top: 6px; } /*Formats images, is class so can be reused on same page*/ .imgLeft { float: left; padding-right: 10px; padding-bottom: 0px; margin-top: 0px; } .imgRight { float: right; padding-left: 10px; padding-bottom: 0px; margin-top: 0px; } /*Wraps all Divs Up*/ #wrap { position: relative; min-height: 100%; width: 640px; margin: auto; background: top left repeat-y; } /*Deals with head navigation bar*/ #headwrap { } #logo { padding-left: 0px; text-indent: 10px; width: 100%; height: 42px; background: #BBF repeat center; text-align: left; } #navbar { text-indent: 10px; padding-left: 0px; width: 100%; font: 110% 'trebuchet ms', Arial, Helvetica, sans-serif; margin: auto; height: 16px; padding-top: 2px; padding-right: 0px; color: #000; text-align: left; background: #DCDCDC repeat-x; border-bottom: 1px solid #ccc; } #navbar li { display: inline; padding-right: 10px; margin: 0; } #navbar ul { padding: 0; margin: 0; } /*Deals with side navigation bar*/ #sidenavbar { float: left; width: 100px; margin-top: 0px; text-align: center; background: #DCDCDC; } /*Deals with main page content*/ #mainwrap { padding-bottom: 0px; } #mainwrap:after { display: block; clear: both; } #content { position: relative; margin-left: 6px; margin-right: 6px; padding: 0 10px; text-align: justify; } /*Deals with the footer*/ #footwrap { clear: both; height: 68px; } #footer { position: absolute; bottom: 0; height: 40px; background: #0054A6 repeat center; width: 100%; color: #FFF; text-align: center; margin: 0 auto; } #footnavbar { position: absolute; bottom: 40px; font: .95em 'trebuchet ms', Arial, Helvetica, sans-serif; width: 100%; height: 28px; padding-top: 8px; color: #000; text-align: center; background: #DCDCDC repeat-x; border-top: 1px solid #ccc; } #footnavbar li { display: inline; padding-right: 10px; margin: 0; } #footnavbar ul { padding: 0; margin: 0; } I ran across a source code and was playing with it to see how it works. The code from what I can tell is mainly for background images. My questoin is, how can I apply a code that will resize the image within the same css coding. I thought it was pretty cool that you can include a large image as the background and it resizes with the window. Not sure this can even be done so that's why I'm asking. Can it be written to resize any or all the images you place on the page? I've included the coding Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title> </title> <style type="text/css"> html, body {margin:0; padding:0; width:100%; height:100%; overflow:hidden;} #content {padding:5px 300px 20px 200px;} body {font-family:verdana, arial, sans-serif; font-size:76%;} #background{position:absolute; z-index:1; width:100%; height:100%;} #scroller {position:absolute; width:100%; height:100%; top:0; left:0; overflow:auto; z-index:2;} </style> </head> <body> <div> <img id="background" src="bg.gif" alt="" title="" /> </div> <div id="fixed"> </div> <div id="scroller"> <div id="content"> <center> <H1>Header Text Here <br> <img src="header_img.png"><br><br> Text here<br><br> Text Text</h1><br> <img src="Just an image here"> </center> </div> </div> </body> </html> Hello, so basically I've got these side bar graphic things I want to put on the edges of my main content table to make it look nice. The problem is I can't seem to figure out how to make them resize their height automatically depending on the length of the main content table, which is slightly different on every page. Since URLs are blocked I guess I have no choice but to just include the code here, ugh. Code: ... <div id="page-container"> <div id="headerer"> </div> <div id="header"> </div> <div id="navpanel"> <img src="images/interface/gorglogowidth.jpg" width="270" height="269" border="0" /><br /> <div id="tvbg"> <div id="main-nav"> <dt id="news"><a href="index.php">news</a></dt> <dt id="episodes"><a href="episodes.html">episodes</a></dt> <dt id="universialinfo"><a href="universialinfo.html">universialinfo</a></dt> <dt id="music"><a href="music.html">music</a></dt> <dt id="contact"><a href="contact.html">contact</a></dt> </div></div></div> <div id="sidebar-b"> <img src="images/interface/panelright.jpg" width="17" border="0" /> <img src="images/interface/bottomrightcorner.jpg" /> </div> <div id="sidebar-a"> <img src="images/interface/panelleft.jpg" /> <img src="images/interface/bottomleftcorner.jpg" width="28"/> </div> <div id="content"> <span class="titletext">Episode 1: The Greatest Planet in Existence</span><br /> <a href="episodes/episode1high.html" target="_blank">High Quality (595MB)</a> <br /> <a href="episodes/episode1low.html" target="_blank">Low Quality (85MB)</a> <br /><br /> <span class="titletext">Episode 2: Savory Dark Truffle</span><br /> <a href="episodes/episode2high.html" target="_blank">High Quality (597MB)</a> <br /> <a href="episodes/episode2medium.html" target="_blank">Medium Quality (264MB)</a> <br /> <br /> <span class="titletext">Episode 3: Spoon the Pretty Bad</span><br /> <a href="episodes/episode3medium.html" target="_blank">Medium Quality (146MB)</a> <br /> <a href="episodes/episode3flashhigh.html" target="_blank">High Quality FLASH FORMAT(Recomended)</a> </div> <div id="panelbottom"> <img src="images/interface/bottommiddle.jpg" width="300" height="28" /> </div> Anyway, the two images, "panel left", and "panel right" (contained in the DIVs "sidebar-a" and "sidebar-b", respectively) go wayyy down, as their native resolution is very large and I was initially hoping to simply be able to scale them down to to match the height of the main content page The CSS file is as follows: Code: ... #page-container { width: 800px; margin: auto; text-align: left; } /* Main Navigation */ #tvbg { background:url(../images/interface/navtvlonger.jpg) } #main-nav { padding-top: 50px; margin-left: 32px; height: 356px; width: 150px; } #header { height: 188px; background: #696969 url(../images/interface/episodesheader.jpg); width: 530px; float: right; } #sidebar-a { float: left; width: 28px; } #sidebar-b { float: right; margin-left: 155px; width: 17px; } #navpanel { float: left; } #content { margin-right: 17px; margin-left: 268px; line-height: 18px; background: #696969; } #content .padding { padding: 25px; } Thanks! Hey guys I'm creating a website as a favor for my boss and I've been trying to do the speed crunch on it and already, one day in I hit a big road block... I can't seem to get the content container and background div to resize with content inside the "content" div. And also, I can't get the footer image for the content container (bottom of the color w/ rounded edges) to float to the bottom of the container. Here is the page in question: http://srh.com/taxgirl/ There are 3 style sheets used so far (as this is a complex website and I want some parts to show on all pages and others to only show on certain pages. Here are the CSS links: http://www.srh.com/taxgirl/srh2008.css http://www.srh.com/taxgirl/css/mainsrh.css http://www.srh.com/taxgirl/css/srh_index.css Code: #contentcontainer { position: absolute; z-index: 3; width: 740px; left: 11px; top: 505px; right: 11px; height: auto; margin-bottom: 70px; overflow: visible; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF; text-align: left; } Code: #contentbg { background-image: url(../images2/required/layout/contentbg.png); background-repeat: repeat-y; background-position: center top; overflow: visible; position: relative; width: 760px; top: 55px; height: 900px; left: 1px; right: 0px; bottom: 65px; z-index: 2; margin-bottom: 63; } #contentcontainterfooter { height: 15px; width: 760px; position: relative; left: 1px; right: 0px; z-index:3; } Here is the HTML: Code: <div class="contentbg" id="contentbg"> <div class="contentcontainer" id="contentcontainer">CONTENTS THAT NEEDS The Content bg to be relative to.</div></div> <div class="contentcontainterfooter" id="contentcontainterfooter"><img src="images2/required/layout/content_bottom.png" width="760" height="15"></div> The text I threw in the DIV is just sample text so please disregard any unlisted or unused class tags, etc. This text will be removed after the issue is solved. If anyone could help I would be forever greatful Please take a look and let me know if you have any advice. Thanks you so--o much! ~beth. ps. This is a side concern, but if anyone knows how to make a png background compatable with IE, please do tell. This isn't too big of a concern for me because if I need to I can just use a gif, but if you know, the knowledge would be welcome and thanked for To all that read: Have a fantastic day and thank you for your time. 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 Page looks fine on my screen but when i resize window-divs overlap or in some cases just text runs on top of other divs messed up. Do I need to set all my width-height values and margins to auto? Margins in my wrap are auto. What are common causes of this? heres my css-its kinda a potpourri Code: #wrap {width:70%; min-width:700px; margin-left: auto; margin-right: auto; } #headertop {background:url(gradient.png); height:40px; } #header {background:url(black.png); height:70px; } .title {float:left; margin:5px; } #menu {float:right; margin-top:30px; margin-right:20px;} .link {float:left; margin-top:8px; margin-left:5px; background:url(gradient.png); border-right:1px solid black; height:auto; width:auto; padding:5px; text-align:center; font-family:Lucida Grande; padding-right:3px; margin-bottom:0px; border-top:1px solid grey; } #floatright {float:right; width:400px; margin:0px; padding-left:10px; border-left:2px double grey; height:350px; background:#000000; } .nav {float:left; height:400px; padding-right:10px; padding-top:50px; } .txt {padding-left:10px;} #bottom{background:#000000; height:10px; margin-top:0px; border:2px solid black;} #content { border:1px solid grey; background:#fffbe9; } .floatl{float:left;} #testarea { padding-top:25px; padding:10px; min-height:330px; background:#ffffff; border-left:1px solid grey; } #testareaalt { width:auto; padding-top:25px; padding:10px; min-height:330px; height:auto; background:#000000; border-left:1px solid grey; } .area {background:url(background.png); height:30px; } .button {width:100px; height:25px; border:1px solid black; background:grey; padding:8px; display:block; } .top {background:000000; height:15px; } h3 {font-family:Sans-serif; background:url(gradient.png); padding:5px; } h4 {font-family:Sans-serif; background:url(black.png); padding:5px; margin:0px; color:#ffffff; } h4.g {font-family:Sans-serif; background:url(black.png); padding:5px; margin:0px; color:#00af33; } p {font-family:verdana; line-height:15px; font-size:13px; padding-left:10px; padding-right:10px; color:7d7d7d;} ul {font-family:verdana; line-height:15px; font-size:13px; padding-left:40px; padding-right:10px; color:7d7d7d;} table {border-collapse:collapse; padding:5px; font-family:verdana; line-height:15px; font-size:13px; padding-left:10px; padding-right:10px; color:7d7d7d; } table.social {border-collapse:collapse; padding:10px; margin:5px; background:url(gradient.png); } } td.alt {background:grey; } #textbox { border:1px solid grey; background:url(black.png);} #menutrial {float:right; margin-right:0px;} .left {float:left; margin:10px; clear:left;} .container{margin:8px;} a:link, a:visited { color: #cc0033; padding:5px; text-decoration: none; font-family:Sans-serif; } a:hover, a:active { /*background-color: #C74350;*/ color: #ffffff; text-decoration: none; text-shadow: 1px 1px 1px #33ff00; font-family:Sans-serif; } #textboxa{ border:1px solid grey; background:#000000;} img.alt {margin-left:90px; margin-right:auto; width:70%; border:0px; } #right{float:right;} |