CSS - Setting Up Layout Centrally For Any Resolution
Hi friends,
I am building my website templates compatible for any resolution ranging from 800x600 to maximum possible resolution. I want to place all the body content exactly in the center (900px layout). I have set the background exactly in the center. but when i am inserting the content, it is displayed from left. How should i set it in the center? please help me! Similar TutorialsFixed. This will be tough, but I'm confident CSS can handle exactly what I need. I want to print onto labels. Actually, they're return address labels (1.75" by 0.5") to be specific. How do I set up a layout with the following specifications? Quote: Sheet Size: 8.5" x 11" (standard sheet of paper) Dimensions: 1.75" x 0.5" (dimensions of each label) Spacing Between Labels: Vertical Spacing 0", Horizontal Spacing 0.28125", Vertical Pitch 0.5", Horizontal Pitch 2.03125" Margins: Top 0.5", Bottom 0.5", Left 0.33", Right 0.33" Can someone give me a starting point and I'll try to figure it out? I'm lost on it. Thanks Hello, i have a very strange problem with css. I want to build a horizontal menu, like tabs. Here is the link of my site. (sorry, its in russian) http://eai.w2o.ru/default.aspx Now you can see red border around the header div. When in layout.css, I remove the border, the header div changes its position (goes down). (in IE and FF (in FF is a little better)) Can you tell me what is my mistake? How can I do the same without that border? Thank you very much! Hello all! Is there a way to set a resolution % for a certain type of resolution size and any above that resolution to another specific % For example I want it to be: 1024x 768 : width : 90%; and anything higher than 1024x 768 to be 80% since 90% on a resolution higher than 1024 for my navigation is just too make of a banner. Please help/advice. Regards, Kingofqueens. I've just recently started using CSS, and unlike tables, I have no clue how the heck to autostretch the layout. Could someone to tell me how to make my page "adapt" to different resolutions for CSS? I don't want to have to make seperate styles for each resolution, is there a simple property and value that I can just insert somewhere with the position property? thanks (sorry i posted this again, I just felt the other post was not clear) Hello, whats your opinion and experience? Wich is the best way to serve diferent css depending on resolution? Using media like this and serve several diferent stylesheets? <link href="css/tablet.css" rel="stylesheet" type="text/css" media="screen and (min-width: 321px) and (max-width: 768px)"> or using this: @import url("tablet.css") screen and (min-width:321px) and (max-width:768px); And is it posible and good or bad idea to have one .css file with diferent css depending on resolution. Is it better to detect resolucion with only javascript? Thanks, appreciate help as I am very stressed and have so many things to fix urgently. Hi, thanks for your time. My problem is with screen resolution, I am currently building a website using 1280 x 1044 pixels. At this resolution the website looks fine. I have used CSS styles and the size page I have used is 80% so there is a blue background around the page. The problem is I have 2 images sized 990 width pixels, at the current resolution they look fine, but when I drop the resolution they will stay the same size (which is now way too big) while the page size will remain a constant 80% so I am left with an image nearly twice as wide as my content. I have thought of splitting one of the images and used a float left and right for it, but the other image is not possible to do that with, I have seen sites with big banners on so how do those images remain constant size even when you change resolution? All help will be greatly appreciated. Many thanks. Craig I am in the process of designing a website and I have dual monitors at home, one is using 1024x768, and other is using 1280x1024 resolution. The website I have designed, off course looks different from one resolution to the other. One the less resolution monitor, the site looks big (my masthead is 750x200 and the whole page is approximately 770x900), however, on the high resolution, the site looks tiny. on 1200 wide resolution my page width is only 770, so there is white (in my case blue) space both sides making it look not so good. Because of the above reason, the site looks big on one monitor and very tiny on the other. I am sure there would be lots of people out there with those two kinds of resolutions (I am mostly concerned about these two resolutions). I wonder how do people deal with this when they are designing a website? Could one find out the resolution of the monitor ahead of time (before displaying the page) and have different css/images be loaded based on the monitor it is being viewed? Is there a concept of floating site -- what I mean by that is if there is a concept of site automatically changing appearance based on screen resolution? Thanks!!! I am having a very strange problem with firefox and different screen resolutions. I have just made a navigation system for a website and tested the links in I.E and F.F - no problems in my screen resolution of 1280 x 1024. I tested it at 800 x 600 and 1024 x 768 and firefox does not change to the hover status when hovering over the link. There are no problems in I.E at the smaller resolutions. Does anyone have any ideas what is causing this problem. After playing around with a few things i discovered that if i change my display from inline to block it works perfectly in firefox at all resolutions - In I.E it causes a step like appearance to the links. Below is the css I am using, I have also added the xhtml at the bottom. Code: #top_button li { margin: 0; display: inline; list-style-type: none; } #top_button a:link, #top_button a:visited { float: left; overflow: hidden; height: 0px; } #top_nav { margin: 0; padding: 0; } #top_button { position: relative; top: 0px; left: 157px; height: 19px; list-style: none; margin: 0; } #t1 a:link, #t1 a:visited { background-image: url(../images/top_nav_home_1.gif); background-repeat: no-repeat; padding-top: 19px; width: 47px; } #t1 a:hover, #t1 a.current { background-position: 0px -19px; } #t2 a:link, #t2 a:visited { background-image: url(../images/top_nav_services_1.gif); background-repeat: no-repeat; padding-top: 19px; width: 63px } #t2 a:hover, #t2 a.current { background-position: 0px -19px; } #t3 a:link, #t3 a:visited { background-image: url(../images/top_nav_portfolio_1.gif); background-repeat: no-repeat; padding-top: 19px; width: 65px; } #t3 a:hover, #t3 a.current { background-position: 0px -19px; } #t4 a:link, #t4 a:visited { background-image: url(../images/top_nav_resources_1.gif); background-repeat: no-repeat; padding-top: 19px; width: 72px; } #t4 a:hover, #t4 a.current { background-position: 0px -19px; } #t5 a:link, #t5 a:visited { background-image: url(../images/top_nav_contact_1.gif); background-repeat: no-repeat; padding-top: 19px; width: 59px; } #t5 a:hover, #t5 a.current { background-position: 0px -19px; } { xhtml Code: <div id="top_nav"> <ul id="top_button"> <li id="t1"><a class="current" href="/" title="home"></a></li> <li id="t2"><a href="/services" title="services"></a></li> <li id="t3"><a href="/portfolio" title="portfolio"></a></li> <li id="t4"><a href="/resources" title="resources"></a></li> <li id="t5"><a href="/contact" title="contact"></a></li> </ul> </div> I would appreciate any suggestions! www.oakdalehosecompany.org or oakdalehosecompany.org is my website Its perfect when you view it with firefox at 1024x768 res, but when you view it with internet explorer at 800x600 res it looks horrible. is there anyway to fix this like a program or something. bear with my this is my fire site i ever made so i dont know much. thanks for any that help Hi All, I have a fixed div which I am using as a footer in my application. here is the screen shot of my page please have a look first so u will understand what i am talking about. http://img192.yfrog.com/img192/5572/1280x768.gif Problem is that if I browse the application on 1024 x 768 pixels it works great but when i change the resolution up to 1280 x 800 pixels the image inside the div change its position. I want this to appear same on every resolution...any suggestions or workaround. the CSS code is below Code: #footer { position: fixed; top: auto; left: auto; width: auto; } here is the HTML Code: <html> <head id="Head1" runat="server"> <link href="../App_Themes/style.css" rel="stylesheet" type="text/css" /> <script src="../Scripts/jquery-1.3.2.min.js" type="text/javascript"> </script> <title></title> <style type="text/css"> .style1 { width: 800px; background-color:White } .style2 { height: 391px; } .style3 { text-align: right; } </style> </head> <body bgcolor="#d7d7d7"> <form runat="server"> <div id="content" style="margin: auto; border: thin solid #C0C0C0; padding: 0px 0px 0px 0px; width: 820px; height: 595px" align="center"> <table align="center" class="style1"> <tr> <td style="font-family: 'Times New Roman', Times, serif; font-size: small; color: #FF0000;" class="style3"> <asp:ContentPlaceHolder ID="StatusBar" runat="server"> </asp:ContentPlaceHolder> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/appHeader.png" /> </td> </tr> <tr> <td class="style2" align="left" valign="top"> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </td> </tr> <tr> <%--<td style="background-color: #FF9933; height: 15px;"> </td>--%> </tr> </table> <div id="footer"> </div> <%-- <table align="center" class="style1"> <tr> <td> <div id="footer"> <img src="../images/footer.png" alt=""/> </div> </td> </tr> </table> --%> </div> </form> </body> </html> I want a table below the container div and want to place my footer div inside that table and on every resolution it should come up the same...i did try but its not working...help need When viewing the test version of my site apparently it has issues with lower resolutions. I'm using 1280x1024 and I guess some people are having issues with it at 1024x768. Is there a way to fix my code so there are no resolution problems, or minimal ones at that? Thanks. Hello, I am using an OS Commerce layout for a client's website. On this page - www.mts-diesel.com you will see how I have the homepage laid out in anticipation of design, with 3 divs of varying colors. One div with an id of #hp_left is where I want to put a nice jquery code. But when I insert that into #hp_left it breaks the whole layout, was seen here www.mts-diesel.com/index2.php I'm not sure what in the css in the code for this script is breaking my layout but Ithought someone here might be willing to shed some light. A big thank you. Tom Hey there! New to code, sort of flying blind but learning a lot as I go along. I'm also kind of shooting for the stars with my design decisions. I was wondering if anyone here has any idea how to mimic the rotating image on Blizzard's website. (As I cannot post the URL, I assume everyone can figure out how to get to Blizzard Entertainment's website easy enough). If you zoom in and out on it, it remains static even as the pieces around it resize over it (this also happens at smaller resolutions). I would desperately like to know how to get it to lock flush against the side of the window like that. Additionally, you'll notice that it doesn't pop a scrollbar onto the window until you shrink the window smaller than the central content. I guess a bigger question is, is this even something achievable in CSS? Do I have to delve into Flash or Javascript to do it, and if so, does anyone know how? Thank you so much in advance! Hi, Ive been asked to create a webpage for a website, the page must be 99% identical to the current website but the problem is I had to build the new page from scratch because a problem with joomla. While creating the page I ran into a big problem aligning the menu bar. Right now the menu bar lines up exactly how it should on my desktop, but on my laptop which has a much larger screen the menu bar is slide way over to the left. here's the website Im making a copy for http://www.curacao.vatcar.org/home/ and here's the page I've made so far http://brandynstestserver.zymichost.com/flight/downloads.html I know it still needs alot of tweaking but I just want to solve the menu problem Heres the HTML, please ignore the comments those are just for the current webmaster (who doesn't know much) until they find another one. Also I just noticed a now unneeded <div id="banner"> tag ignore that too. 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>Virtual Curacao FIR Downloads</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <script type="text/javascript"> var timeout = 50; var closetimer = 0; var ddmenuitem = 0; function mopen(id) { mcancelclosetime(); if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } document.onclick = mclose; </script> <body> <div id="page-background"><img src="images/bg.JPG" width="100%" height="100%" alt="Smile"></div> <div id="content"><div id="banner"><center><img src="images/banner.png"/></center></div> <ul id="sddm"> <li><a href="http://www.curacao.vatcar.org" onmouseover="mopen('m1')" onmouseout="mclosetime()"><center>Home</center></a> </li> <li><a href="http://www.vatcar.org/website/index.php?option=com_content&view=article&id=5&Itemid=40" onmouseover="mopen('m2')" onmouseout="mclosetime()"><center>Roster</center></a> </li> <li><a href="http://www.vatcar.org/forum/index.php?board=6.0&Itemid=54" onmouseover="mopen('m1')" onmouseout="mclosetime()"><center>Forum</center></a> </li> <li><a href="http://www.curacao.vatcar.org/home/index.php?option=com_jobline&Itemid=61" onmouseover="mopen('m1')" onmouseout="mclosetime()"><center>Career Opportunities</center></a> </li> <li><a href="http://www.curacao.vatcar.org/home/index.php?option=com_content&view=article&id=56&Itemid=66" onmouseover="mopen('m1')" onmouseout="mclosetime()"><center>Contact Us</center></a> </li> <img src="images/menuspacer.jpg" /></ul> <table width="982" border="0" cellspacing="0" cellpadding="0" background="images/body.jpg" align="center"> <tr> <td> </td> <td><h2>Downloads</h2></td> <td> </td> </tr> <tr> <td> </td> <td> <!--Downloads will go under this comment, dont edit anything above this--> <h2><center>Charts</center></h2><!-- this little piece of code it just a centered heading, hence the <h2> and <center> tags around the words you want to be the heading--> <!-- use this format to add downloads, type <a href="LINK TO DOWNLOAD HERE">Name of the download</a> and thats it. That code will display text saying what ever you typed in the "Name of the donwload" section and when you click on the words it will download the file that is located in the "LINK TO DOWNLOAD HERE" section. Heres a few working downloads below for you go go off of--> <center><a href="downloads/charts/TNCA/TNCACharts.zip">TNCA Charts package</a><br /> <!-- The <br /> is just a line break--> <a href="downloads/charts/TNCB/TNCBCharts.zip">TNCC Charts package</a><br /> <a href="downloads/charts/TNCC/TNCCCharts.zip">TNCB Charts package</a><br /></center> <h2><center>ATC</center></h2> <center><a href="downloads/ATC/Training Files.zip">Training package</a><br /> <a href="downloads/ATC/TNCF Control.zip">TNCF Control package</a><br /></center> <!-- Dont edit anything below this comment--> </td> <td> </td> </tr> <tr> <td colspan="3"><img src="images/bottom.jpg"/></td> </tr> </table> </div> </body> </html> Heres the CSS Code: @charset "utf-8"; /* CSS Document */ html, body {height:100%; margin:0; padding:0; font-family: Arial, sans-serif, Verdana, Helvetica; } #page-background {position: fixed; top:0; left:0; width:100%; height:100%;} #content {position:relative; z-index:1; padding:10px;} #sddm { margin:0 0 0px .6em; padding: 0; z-index: 30 } #sddm li { margin:0 auto; padding: 0; text-align: left; list-style:none; float: left; font: bold 15px sans-serif} #sddm li a { display:block; margin-left: auto; margin-right: auto; padding: 8px 5px; background: url(images/mainmenu.jpg) repeat-x left top; color: #FFF; text-decoration: none } #sddm li a:hover { background: #000; width:auto; font-size: 15px; } Thank you in advance for the help! Hi there, I'm working on a site on behalf of a charity (non profit social enterprise) www.ableradio.com What I am trying to do is make the banner fit on screen, and stay centred when users resize the page (or have diffrent resolution). The site is a joomla based site, so i am constricted to making changes only to the css files. currently this is the css that governs the banner; Code: #gk-mainnav{ width: 977px; height: 80px; position: reletive; padding:7px 0 0 0; background:transparent rl('../images/menu_bg_top.png') no-repeat right top; padding-bottom:100px; } #gk-mainnav2{ height:50px; width:977; line-height:39px; font-size:90%;font-weight:bold; text-transform:uppercase; padding:0 20px; margin-top:100px; } Basically, i have replaced menu_bg_top.png with our banner, and a space for the menu bar to sit on top of it. The problem is, if your running an 800x600 resolution then the banner is cropped to fit rather than resized. Idealy the banner should resize and fit the width of the screen, but if this cannot be possible, then keeping it centred will suffice (holding ctrl+mouse wheel down to zoom out, shows how the banner doesn't resize, AND how it doesn't center). If i could find the main php file from which joomla creates each page i could insert the code there with some java script that resizes the image based on resolution etc... but i am limited to the style sheets only. Thanks for any help ^_- Take care, Steve. Hello, I am resolving problem on my website. You can see example the http://subrjiri.cz/domains/subrjiri.cz/sanc-akustika.cz/ There is a Header, Main and Footer. Header and main are margin left and right: auto, cause width is 900px and it's on middle. Footer part isn't 900px, its full width and some height. The problem is that the footer is black background and top is white. And of course when somebody has really high resolution, then he see good header, good main, good footer and then blank white place depending on his resolution. That blank space is under footer. Of course footer should be on the bottom of the page for all resolutions and no white place under footer. You can see that problem on this link http://subrjiri.cz/domains/subrjiri.cz/sanc-akustika.cz/akusticka-studie cause there is not too much text, on big pages it's without problem. You can see blank white place under footer. I can set high padding for footer but it doesn't look nice. Thanks for your opinion. Hi There.. I am still learning CSS/Xhtml so please be patient and understanding, . Anyway, I am making a site for my business and wanted to try some new idea. Everything looks good except for my navigation bar in IE. Whenever I change resolution the navigation bar moves out of position and I have to refresh to get it to snap into place. In Firefox and Chrome I do not have this issue. I have been googling trying to find the solution but have come up empty. Could someone look at my code and tell me when I did wrong so I don't make the same mistake again? Thanks for your help. Here is the CSS: <style type="text/css"> <!-- #html, body { top: 0px; right: 0px; bottom: 0px; left: 0px; width:920px; height: 100%; background: url(desk.jpg) white center no-repeat; background-repeat:no-repeat; margin: 0 auto; text-align: center; font-family: Verdana, Helvetica, sans-serif; } #container { width: 900px; height:840px; background-image: url(bg1.png); margin: 0 auto; text-align: left; } #mainContent { padding: 3px 60px; margin-top: 0px ; } #text { padding: 0; margin-left: 35px; text-align: center; } #navigation { float:right; display:block; width: 400px; margin-top: 15px ; font-family:Trebuchet MS, Helvetica, sans-serif; overflow:hidden; } #navigation ul { float:left; list-style:none; margin:0; padding:0; position:relative; left:50%; text-align:center; } #navigation ul li { display:block; float:left; list-style:none; margin:0; padding:0; position:relative; right:50%; } #navigation ul li a { display:block; margin:0; padding:.4em .8em; color:#000; text-decoration:none; line-height:1.3em; } #navigation ul li a span { display:block; } #navigation ul li.active a { color: #fff; font-weight:bold; } #navigation ul li a:hover { color: #fff; font-weight: bold; } .guy { float: right; margin-top: -70px; } .yell { float: left; margin-top: 20px; padding-bottom: 0px; margin-right: 30px; margin-left: 20px; } .second { margin-top:45px; } #footer { font-size: 11px; margin-bottom: 10px; } --> |