CSS - Css Div Size Problem
Hi,
Im trying to code a small portfolio page but im having trouble with the sizing of one of the sections. Here is my page: http://www.zombiemod.com/blog/?cat=1#all Here is my code for the div: Code: #container div { margin-right:3px; float:left; width:296px; height:130px; border:1px solid #999; position:relative; overflow:hidden; } How do I make the Div display this size correctly? Similar TutorialsHello all. THis is my first post here . I use em to define font-size at my site. At main css file... body { font-size: 76%; } tr, p, div, td, div { font-size: 1em; } at secondary css file... div#content_area .contentpaneopen { font-size: 1.1em ; line-height: 1.3em; } The problem is that the text (content_area) displays correctly on firefox and Opera and wrong on IE. I need em because i use a auto font resize javascript file.I am trying to find what is wrong for days...! please check at this link... I am sorry about the greek encoding Thank you Hello, I have a code below which works fine in IE and Firefox. However in Opera the 4 boxes are displayed in a 2x2 form insetad of 4x1. Any idea? 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>Untitled Document</title> <style type="text/css"> #container { margin: auto; padding:0px; width: 980px; border: 1px solid #000000; } #center { margin: 0px; padding: 0px; clear:both; } #left_panel { width: 240px; float:left; border:1px solid #ff0000; } #main_panel { padding: 0px; margin: 0px; margin-left:295px; width:660px; border:0px solid #ff0000; } #main_panel #main_panel_header { padding-top: 5px; border:1px solid #ff0000; overflow:hidden; } #main_panel_header .photo_box { float:left; background-color:#000000; } #main_panel_header .photo_box img { background-color: #000000; height: 115px; width: 140px; border:2px solid #000; border-bottom:0px; margin:0px; } #main_panel_header .photo_box a{ color: #ffffff; text-decoration:none; font-size:10px; font-weight:bold; display:block; text-align:right; text-transform: uppercase; width:140px; float:left; padding:2px; margin:0px; background-color:#000000; } </style> </head> <body> <div id="container"> <div id="center"> <div id="left_panel"> Menu1<br/>Menu1<br/> </div> <div id="main_panel"> <div id="main_panel_header"> <div class="photo_box"> <img src="style/tmp/pic.jpg" /> <a href="#">Link</a> </div> <div class="photo_box"> <img src="style/tmp/pic.jpg" /> <a href="#">Link</a> </div> <div class="photo_box"> <img src="style/tmp/pic.jpg" /> <a href="#">Link</a> </div> <div class="photo_box"> <img src="style/tmp/pic.jpg" /> <a href="#">Link</a> </div> </div> </div> </div> </div> </body> </html> So I've got a page on which a menu exists (or will) that is a certain width, I believe 854px. Now I know that this isn't the best idea, but I'm following someone's specific orders so meh. Now, my problem is that I want the page to resize according to the browser size and fill the page, so if the browser size is 1054 then I want the background image at the top to run the entire width of the page, and the menu, I'd want to center. Now if the browser is 854px or wider, then the page looks fine, but when the browser is anything less, then the menu, because it is a specific width, expands as it should as well as centers itself forcing a horizontal scroll bar, but the rest of the page is acting like it is ONLY 854px and therefore it cuts off and is now no longer centered with the menu. It must be possible to do, right? Here's a link to the page I'm using for debugging purposes http://www.agentjeff.com/headerv10.html I have set up a couple vertical boxes and filled them with 'column' boxes all nested within the parent vertical boxes. My problem is when, say, box #3 from the left has more content than the furthest left box, instead of stretching the parent to accommodate the content and push down the other parent horizontal box below, the content just flows behind the lower horizontal box. If the content in the furthest left box is the longest, this problem doesnt occur. The parent box is stretched to fit. Thx Joe ####################### html ######################### <html> <head> <meta http-equiv="Content-Type" charset=windows-1252> <link rel="stylesheet" href="test.css" type="text/css" media="screen,projection,print" title="Default" /> </head> <body id="savor-home"> <div id="main"> <div id="abovefold"> <div id="column-a"> <div id="type2"> blah<br> blah<br> blah<br> blah<br> </div> </div> <div id="column-b"> <div id="type1"> blah<br> blah<br> blah<br> blah<br> </div> </div> <div id="column-c"> <div id="type2"> blah<br> blah<br> blah<br> blah<br> </div> </div> <div id="column-d"> <div id="type1"> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> </div> </div> </div> <div id="maincontent"> <div id="column-a"> <div id="type1"> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> </div> <div id="column-b"> <div id="type1"> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> </div> </div> <div id="column-c"> <div id="type2"> blah<br> blah<br> blah<br> blah<br> blah<br> blah<br> </div> </div> </div> </div> </body> </html> ####################################### css ####################################### body { margin: 0px; background: #fff; } #main { width: 780px; min-height: 1500px; } #savor-home #abovefold { position: relative; top:0px; left:0px; width: 100%; width: 780px; clear: both; } #savor-home #abovefold #column-a { background: #eee; width: 185px; position: relative; top:10px; left:10px; display: inline; } #savor-home #abovefold #column-b { background: #ddd; width: 185px; position: absolute; top:10px; left: 205px; display: inline; } #savor-home #abovefold #column-c { background: #ccc; width: 185px; position: absolute; top:10px; left: 400px; display: inline; } #savor-home #abovefold #column-d { background: #bbb; width: 185px; position: absolute; top:10px; left: 595px; display: inline; } #savor-home #abovefold #type1 { background: url("/img/savor/featcontent1.jpg") no-repeat; width: 100%; /* hide from IEMac\*/ width: 185px; \width: 185px; w\idth: 165px; *width: 185px; /* end hiding */ padding: 10px; font: 12px verdana,arial,helvetica,sans-serif; color: #000; } #savor-home #abovefold #type1 h2 { color: #000; } #savor-home #abovefold #type1 h4 { color: #B5390F; padding: 1px; } #savor-home #abovefold #type1 a:link, #savor-home #abovefold #type1 a:visited { color: #000; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #abovefold #type1 a:hover { text-decoration: underline; color: #B5390F; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #abovefold #type2 { background: url("/img/savor/featcontent2.jpg") no-repeat; width: 100%; /* hide from IEMac\*/ width: 185px; \width: 185px; w\idth: 165px; *width: 185px; /* end hiding */ padding: 10px; font: 12px verdana,arial,helvetica,sans-serif; color: #000; } #savor-home #abovefold #type2 h2 { color: #000; } #savor-home #abovefold #type2 h4 { color: #B5390F; padding: 1px; } #savor-home #abovefold #type2 a:link, #savor-home #abovefold #type2 a:visited { color: #000; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #abovefold #type2 a:hover { text-decoration: underline; color: #B5390F; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #maincontent { position: relative; top:0px; left:10px; background: #0f0 url("/img/savor/maincontent.jpg") no-repeat; width: 770px; } #savor-home #maincontent #column-a { width: 256px; position: relative; top:10px; left:0px; } #savor-home #maincontent #column-b { width: 256px; position: absolute; top:0px; left: 256px; } #savor-home #maincontent #column-c { width: 256px; position: absolute; top:0px; left: 512px; } #savor-home #maincontent #type1 { width: 100%; /* hide from IEMac\*/ width: 256px; \width: 256px; w\idth: 236px; *width: 256px; /* end hiding */ padding: 0 10px 0 10px; font: 12px verdana,arial,helvetica,sans-serif; color: #000; border-right: 1px dotted; } #savor-home #maincontent #type1 h2 { color: #000; } #savor-home #maincontent #type1 h4 { color: #B5390F; padding: 1px; } #savor-home #maincontent #type1 a:link, #maincontent #type1 a:visited { color: #000; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #maincontent #type1 a:hover { text-decoration: underline; color: #B5390F; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #maincontent #type2 { width: 100%; /* hide from IEMac\*/ width: 256px; \width: 256px; w\idth: 236px; *width: 256px; /* end hiding */ padding: 0 10px 0 10px; font: 12px verdana,arial,helvetica,sans-serif; color: #000; } #savor-home #maincontent #type2 h2 { color: #000; } #savor-home #maincontent #type2 h4 { color: #B5390F; padding: 1px; } #savor-home #maincontent #type2 a:link, #savor-home #maincontent #type2 a:visited { color: #000; font: bold 10px verdana,arial,helvetica,sans-serif; } #savor-home #maincontent #type2 a:hover { text-decoration: underline; color: #B5390F; font: bold 10px verdana,arial,helvetica,sans-serif; } Hi, This is only happens in IE, in firefox (the only 2 browsers I tested) works fine. http://nazgulled.no.sapo.pt/test.html There's only one image inside the <div> tag, and I have set that div tag style to have a 10px height. But that doesn't work on IE... it's like there were some spaces wich because of the font-size it makes the height be more than 10px.... I wanted to fix that but how can I do it? One solution is to make the div tag like this: Code: <div id="test"><img src="spect.gif" width="300" height="10" /></div> instead of this: Code: <div id="test"> <img src="spect.gif" width="300" height="10" /> </div> But I don't want to fix it that way... Any help would be hot, thanks. I have the following CSS styles: Code: #content p { font-size: 24px; } .smalltext p { font-size: 12px; } Then, I create a #content div in my HTML with three paragraphs in it. I want the middle paragraph to have the .smalltext class, like this: http://www.toprival.com/temp/css_question.gif With the CSS the way I have it, the font size (12px) of the .smalltext paragraph is ignored. But if I change the CSS so both selectors are IDs, or so both are classes (and update the HTML accordintly), it works. Why is that? Having a strange problem with textarea font sizes in Firefox (1.06) See here - http://www.4L.ie/contact.php Text entered in the text fields is appearing correctly, but when entering text into the "Your Query" textarea, the font-size is noticeably smaller and less legible. It appears fine in IE6. My CSS relating to fonts is as follows: Code: body { font: 76% verdana, arial, helvetica, sans-serif; } input, select, textarea { font-size: 1em; } If I use pixels (ie font-size: 12px) there is no problem. Ems and % seems to mess things up. Anybody able to shed some light on this? A possible bug in Firefox 1.06? Thanks in advance. Hi guys, I'm working on a layout for a client, and I've run into a problem I've never seen before. My code is fully valid CSS (except for the *html IE fixes) and fully valid transitional XHTML, and it works fine in FF, IE and even Safari - but as soon as I load it up in Opera, it breaks completely. The font size is absolutely HUGE for some reason (like 400% of normal!), and it is completely breaking my layout. I have no idea why this would be happening, and it's immensely annoying. I'm setting all of the font sizes throughout the page in ems, and at the start of the css I declare the following: Code: html, body { height: 100%; margin: 0px; padding: 0px; text-align: center; font: 62.5% Tahoma, Verdana, Arial, Sans-Serif; /* Resets 1em to 10px */ background-color: #000000; } Now this should be fine, and indeed it works in every other browser.. but Opera is wigging the hell out, and I don't know what's wrong. Has anybody ever experienced anything like this? If so, please let me know! I'm hesitant to post the full code because it's covered by a hefty NDA, but I can strip out confidential bits if needed. Thanks everyone! Hi there, I'm completely new to CSS. I'm trying to do this more than one hour but can't get it right. Code: <font color='white'><font size='1' face=verdana size=1> I couldn't find the equivalent of this in CSS This is my last experiment but it doesn't seem to work either Code: fontstyle { color : #FFFFFF; font-family : verdana ; font-size :1;} Thanks I could see this as potentially being really easy to do or really hard to do. I'm hoping for the former. Suppose I have 3 divs, A, B, C and that I want the total width of A + B + C to equal the width of the screen. Suppose also that I want them to be inline. How can I have B to be a fixed width while A and C expand depending on the screen width (such that the width of A = the width of C)? So when using Netscape 7.2 & Opera 7.5 and MSIE 6.0, How do you get a simple tag like body { font-size:small; } to be equal in all browsers? Setting IE Text Size to Medium, and Opera's Zoom to 100% (both defaults) and Netscape 7.2 to 120% (not the default) is one way, but is there a CSS way? By the way, the child element hack "body>div {property}" wasn't working no matter what I tried, by not working I mean to say Netscape never would read it or apply it. It appeared to be that Opera & IE need to read the same value while Netscape needs to apply a larger size to be equal to IE's and Opera's rendering. B This should be fairly simple, but I can't figure it out right now. I have a list of nav buttons that I have floated so they are inline. When I hover over them, a 4px border appears at the bottom. The problem is, it pushes my content container down on hover. I've tried margins and padding in different places, but can't seem to prevent it from happening. How do you prevent this? Code: #navcontainer { display:inline; } #navlist { margin: 0; padding: 0; padding-bottom:20px; border-bottom: 1px solid #FDC737; float:right; } #navlist ul, #navlist li { margin: 0; padding: 0; display: inline; list-style-type: none; } #navlist li { line-height: 14px; } #navlist a:link, #navlist a:visited { float: left; font-weight: bold; margin: 0 10px 4px 10px; text-decoration: none; color: #fff; } #navlist a:link#current, #navlist a:visited#current, #navlist a:hover { border-bottom: 4px solid #FDC737; padding-bottom: 2px; background: transparent; color: #FDC737; } #navlist a:hover { color: #fdc737; } Code: ----------------------------------------------------- | | H1 |image| | | H2 Inline nav tabs ----------------------------------------------------- Is it possible to define the size of a DIV, by distance to the edges? We have > 400 products in our children's boutique in Infant Girl as an example. Right now, you click 1-20, 21-41, etc. to view them by 20. I'd like to give people a way to view all, but here's my problem. I use a horizontal looper asp program to show 3 colms and products and how ever many rows required to show 20. Behind this I use a white CSS box that looks like this. <span class="detailsboxlist"></span> There's nothing in it. I use layers to push it behind the products. How can I now make it dynamically scale to the view all (400+ products) which change all of the time? Thanks!!! Mike http://www.santeecooperobgyn.com/obgyn I have just begun to design a website and already I have run into bizarre (to me) behavior. In the horizontal navigation bar, when you run your mouse over it, you can see that the inline element is bigger than the block element container because the background color changes, revealing a small 2px or so size difference. Here is the relevant CSS. Code: * { padding: 0px; margin: 0px; } #navbar { list-style-type: none; margin-left: 0px; background-color: #336633; padding: 0em; height: 2em; margin: 0px; font-size: 10pt; } #navbar li { display: inline; float: left; padding: 0.5em; } #navbar li a { color: white; text-decoration: none; text-transform: uppercase; padding-left: 10px; padding-right: 10px; padding-top: 0.5em; padding-bottom: 0.5em; vertical-align: baseline; line-height: 100%; } #navbar li a:hover { background-color: #669966; I have no idea why this happens, unless the inline element content height is actually determined by factors other than the line-height. It seems like the total height should sum to 2em in both cases. Hello. I was wondering how I would go about doing this. I have a div, the left and right side of it is an image that I want the size to be able to be fluctuated, say, if the div goes larger than say 50 px, then it will start repeating and get larger. I have tried to start this already, but I havent had any luck. I also am not having any luck on getting the backgroun image to show. Anyone here know how I would make it to where my left or right side (border-right, border-left) will automatically resize if it is needed to go larger or get my background image to show? It's for a news conent box for my website I am coding, and I need it to go larger than just a set value. Thanks for your help. P.S. this is what I have so far Code: <div style="width:460; height: auto; border-right: url("images/border_right.gif"); border-left: url("images/border_left.gif"); background-image: url("images/content_content.gif"); background-repeat: repeat;"> News content will go here </div> hi, someone using foxfire keeps saying the my font is really really tiny, I have my css file like:
Code: body { background: #FFFFFF; /* for internet explorer */ scrollbar-face-color: #FFFFFF; scrollbar-highlight-color: #FFFFFF; scrollbar-shadow-color: #FFFFFF; scrollbar-3dlight-color: #494969; scrollbar-arrow-color: #494969; scrollbar-track-color: #FFFFFF; scrollbar-darkshadow-color: #494969; margin: 0px; padding: 0px; border: 0px; border-top: 1px solid #8E9397; border-left: 1px solid #8E9397; font-color: #494969; font-family: Verdana,Arial,Helvetica; font-size: 8pt; text-align: left; } a:link,a:active,a:visited { color: #494969; text-decoration: none } a:hover { text-decoration: underline; color: #494969; position: relative; top: -1px; left: -1px; } hr { background: transparent; color: #494969; height: 1px; border-width: 0px; } fieldset { margin: 0; padding: 1px; border: 1px solid #494969; } legend { margin: 0; padding: 7px; color: #494969; background: transparent; font-weight: bold; } img { border: 0px; } table { background: transparent; } tr { background: transparent; } td { background: transparent; color: #494969; font-family: Verdana,Arial,Helvetica; font-size: 70%; } input, textarea, select { color: #494969; font: normal 11px Verdana, Arial, Helvetica, sans-serif; background: transparent; border: 1px solid #494969; border-style: inset; text-align: center; text-indent: 2px; } form { margin: 0px; padding: 0px; } any idea on whats wrong? and I would of changed the % to an actual value but I wanted to make it so people can control the size of the font to lager or smaller here is a preview with that css file in use : http://www.dbznetwork.net/ Hello, I have something has follows: <div> ... <table> ... </table> </div> My document font size is 1em. My div font size is 1.4em. What should be the font-size in my table to get back to the 1em of the document? Thanks, Miguel I'm not a programmer by nature, but am picking things up as I go along. I'm working on some forms to make my job easier. Hopefully what I will provide below is enough info to provide a solution. If not, let me know what else you might need. I understand that this section of CSS manipulates the size and other attributes of the textarea input box: fieldset div input,fieldset div textarea { width:150px; border-top:1px solid #555; border-left:1px solid #555; border-bottom:1px solid #ccc; border-right:1px solid #ccc; padding:1px;color:#333; } What I am looking for is what do I need to add to my CSS and consequent HTML markup to have other textarea input boxes with different attributes? What I really need is to have 4 small boxes within the same div on the same row. Thanks in advance!! Hi, For some reasons, my CSS linked file is not taking any more rules. Is there a maximal number of rules per CSS file? Thanks |