CSS - I've Tried All Day Long Yesterday And Still...
Hello Devshed! I'm new to CSS and i'm having some problem with position and i think with div's as well. When i resize the browser window, move the borders, images move also.
Also when i add images, as you can see i have to add really big negative values to bring them on top of each other. What am I doing wrong and how should I code in a professional matter? This is what I've worked on so far: http://www.stars.ehlo.ro/ HTML: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content="USN, United Stars, Gaming, Network,counter-strike, CS, 1.6, servers, tracker, games, community, forums" /> <meta name="description" content="USN - United Stars Network is a gaming network offering players to easily interact" /> <meta name="Revisit-After" content="2 Days" /> <meta name="robots" content="all,index" /> <meta name="author" content="Sergiu/z3rongod for www.usn.ro." /> <title> United Stars Network | Gaming Network | Home </title> <link rel="shortcut icon" href="www.usn.ro/favicon.ico"> <link rel="icon" href="www.usn.ro/favicon.ico"> <style type="text/css" media="screen"> /* <![CDATA[ */ @import url(index.css); /* ]]> */ </style> </head> <body> <div id="wrapper"> <!-- Bara de sus --> <div id="topbar"> <img src="webimages/topbar.png" /> </div> <div id="usnbanner"> <img src="webimages/usnbanner.png" /> </div> <div id="topheader"> <img src="webimages/topheader.png" /></div> <div id="navbarborder"></div> <div id="navbarbox"> </div> <div id="mboxborder"> </div> <div id="mbox"> </div> <div id="downbar"> <img src="webimages/downbar.png" /></div> <div id="dboxborder"> </div> <div id="dbox"> </div> <!-- ======== Google Reclama ====== --> <div id="gleader"> <img src="webimages/gleader.png" /> </div> <div id="gside"> <img src="webimages/gside.png" /> </div> </div> <!-- Flags --> <div id="flags"> <div id="usflag"> <img src="webimages/usflag.png" /> </div> <div id="roflag"> <img src="webimages/roflag.png" /> </div> </div> <!-- Big Links --> <div id="biglinks"> <div id="bbhome"> <img src="webimages/home.png" /> </div> <div id="bbservers"> <img src="webimages/servers.png" /> </div> <div id="bbforums"> <img src="webimages/forums.png" /> </div> <div id="bbfiles"> <img src="webimages/files.png" /> </div> <div id="bbnews"> <img src="webimages/news.png" /> </div> <div id="bblinks"> <img src="webimages/links.png" /> </div> </div> <!-- Navbar --> <div id="navbar"> <div id="nhome"> <img src="webimages/nhome.png" /> </div> <div id="nborder1"> <img src="webimages/nborder.png" /> </div> <div id="nforum"> <img src="webimages/nforum.png" /> </div> <div id="nborder2"> <img src="webimages/nborder.png" /> </div> </div> </div> </body> </html> CSS: Code: /* ToC 1. defaults 2. structure 3. links and navigation 4. fonts 5. images Notes */ /* Defaults */ /*Avoid default browser margins and padding */ * { margin: 0; padding: 0; } /* Avoid browser font resize */ html { font-size: 100%; } /* --------- 2. structure --------- */ body { font: 100%/2 Verdana, Arial, Helvetica, sans-serif; background: #000000; } #wrapper { font-size: 1.2em; line-height: 1.2em; padding: 0; background: url(background-drop-shadow-2.gif) 50% 0 repeat-y; width: 920px; margin: 0 auto; } /* ============== Layout pictures ============== */ #topbar { position: relative; float: middle; } #usnbanner { position: relative; float: middle; top:-4px; } #topheader{ position:relative; float: middle; top:-8px; } #mboxborder{ position: relative; float: right; background: #c7ced6; width:747px; height:300px; top:-312px; left:-2px; } #mbox{ position: relative; float: right; background: #e9f2fb; width:746px; height:300px; top:-612px; left:-2px; } #navbarborder{ position: relative; float: middle; background: #c7ced6; width:164px; height:300px; top:-12px; left:5px; } #navbarbox{ position: relative; float: left; background: #e9f2fb; width:162px; height:300px; top:-312px; left:6px; } #downbar{ position: relative; float: left; top:-612px; } #dboxborder{ position: relative; float: left; background: #6da7e6; width:918px; height:214px; top:-616px; left:0px; } #dbox{ position: relative; float: left; background: #e9f2fb; width:910px; height:208px; top:-828px; left:4px; } /* Reclama Google Adsense */ #gleader{ position: relative; float: left; top:-1526px; left:2px; } #gside{ position: relative; float: left; top:-1480px; left:665px; } /* ======= flag icons ======= */ #roflag{ position: relative; float: left; top:-1840px; left:520px; } #usflag{ position: relative; float: left; top:-1840px; left:490px; } /* ======== Big Buttons ====== */ #bbhome{ position: relative; float: left; top:-1518px; left:48px; } #bbservers{ position: relative; float: left; top:-1518px; left:138px; } #bbforums{ position: relative; float: left; top:-1518px; left:208px; } #bbfiles{ position: relative; float: left; top:-1162px; left:-157px; } #bbnews{ position: relative; float: left; top:-1162px; left:-60px; } #bblinks{ position: relative; float: left; top:-1162px; left:33px; } /* ============= Navigation Bar =========== */ #nhome{ position: relative; float: left; top:-1478px; left:-608px; } #nborder1{ position: relative; float: left; top:-1463px; left:-698px; } #nforum{ position: relative; float: left; top:-1446px; left:-791px; } #nborder2{ position: relative; float: left; top:-1461px; left:-237px; } h1 { font: 1.5em/1.8em Verdana, Arial, Helvetica, sans-serif; text-transform: uppercase; color: #ffffff; } p { margin-bottom: 1.5em; color: #ffffff; } /* ---------- 3. links and navigation ---------- */ /* ---------- 4. fonts ---------- */ /* ---------- 5. images ---------- */ Yours gratefully and impatiently, Sergiu. Similar TutorialsI have a div using width Code: div.contain { width:200px; font-style:italic; } Say, I have a long word such as: Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu If i have multiple words, they will break after 200px width. Is there any CSS tag that will contain long words? I am trying to get some URLs to wrap within table cell which I am able to do with the CSS "word-wrap:break-word". However, when it comes to Mozilla, this CSS property does not work. I understand that the word-wrap property is specific to IE. But does anyone know of a way to make this work with Mozilla? If I have to parse the string incvolved with Javascript, so be it! (But please don't make me!!) Hi How can I wrap a long line of text inside a fixed width div? Hi I'm in the middle of creating a web forum, and I've run into a little 'snafu'. Forum replys have a fixed width design so when words are used that are greater than width of the design, 500px, the word actually expands the design. All I want is for the word to stop at 500px and begin on a newline. A picture can always explain it better: Code: <table class='forum_block'> <thead> <th>mikeymike</th> </thead> <tbody> <tr> <td class='post_text' colspan='2'>gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg ggggggggg</td> </tr> <tr> <td class='post_date' colspan='2'>1280199359</td> </tr> </tbody> <tfoot> <tr> <td colspan='2'><a href='?edit=51'><button><img src='/_images/icons/comment_edit.png' />Edit</button></a> <a href='?post_form=17'><button><img src='/_images/icons/comment.png' />Post reply</button></a> <a href='?post_form=17,quote=51'><button><img src='/_images/icons/comment_add.png' />Quote</button></a> </td> </tr> </tfoot> </table> Code: .forum_block { font-family: verdana, Arial, Helvetica, sans-serif; width: 99%; margin: 10px auto; } .forum_block th { background: #b7cade; font-weight: bold; color: #fffefe; padding: 0.5em; } .forum_block td { background: #efeeee; border: solid 2px #efeeee; padding: 0.5em; } .forum_block td textarea, .forum_block td input { background: #efeeee; width: 510px; } .forum_block tfoot td { background: #b7cade; border: none; color: #fffefe; font-weight: bold; padding: 0.5em; } .forum_block .post_text { font-family: Georgia, "Times New Roman", Times, serif; } .forum_block .post_date { font-size: 0.7em; text-align: right; font-style: italic; } I just can't seem to figure this out! it is driving me nuts! The page I am working on is he http://www.iskippedlunch.com/z_test/index_2.php and the style sheet is he http://www.iskippedlunch.com/z_test/styles/shfb_basic.css I am using php to import sections into the page. For some reason when I include the Client Story (blue) section on the homepage all the content in the green sidebar gets pushed way down the page in a couple versions of IE6. I have narrowed the problem down to this area of code, it is the only part that makes the page go wonky. I even rewrote the CSS, but I must be missing something. The lower levels of the site are based on this home page, and have the same problem if the main (white) content is long. You can see how some have the problem and some display correctly. Help will be greatly appreciated, my eyes are getting crossed! PS, on some of the lower level pages, the (orange)footer background creeps up the page! This is new! hi i have a page that contains a large html table. this table spans many pages (in internet explorer it spans 6 pages). however, when i view the print preview in firefox it only shows 1 of 1 page, and at the bottom of the page, where i would expect a page break to exist, the table continues on and then off the bottom of the page. basically, it seems to be attempting to render the entire table on to one page, even though it won't fit. has anyone got any ideas how i can make this table print on multiple pages? i've read somewhere that gecko based browsers have a problem with floated content, but i'm sure i've un-floated everything. thanks in advance. dave Hello, I'm currently in the works of converting an old HTML site of mine into CSS and have run into what seems to be a notorious problem with the page text not pushing the footer down when the text gets to a certain length. Instead the text just covers and hides the footer. I've been trying to remedy this problem for about a week, but to no avail. I've Googled this problem and tried the suggested fixes, but once again have had no such luck. I'm left to believe that every instance is unique. If you view the Style Sheet, I have the 'footerlinks' set at an "Absolute" position because it looks fine on the other pages and I do relize this will have to be changed. As to what else has to be changed I would really appreciate some input as to what I need to do to get the footer to slide down when the text gets lengthy. ------- Here's a link to the page thats having issues with the footer... *** Note: I keep getting an error message saying I can't post URLs on this forum because I have a new user account so below this line is the link to the page I'm having trouble with without the http:// ........ infoheaven.bravepages.com/Testamonials/Testimonials.htm The URL to the STYLE SHEET is located at the top of the page between the "Head" tags of the website source code I provided above. I tried listing my CSS code here, but once again I kept getting the "New user accounts are not permitted to create posts containing URLs" error message. Sorry for the inconvenience.... Dan - Anybody know how to force a long string of text that doesn't contain any spaces to wrap inside its containing div, and not just sprawl outside of the entire page? I've done some searching and can't seem to find a lot of discussion about this particular problem. If the content contained enough spaces, then the overflow would wrap nicely, but there aren't any. What am I missing here? Thanks This is the line in my index.html: PHP Code: <PRE class=yup>blah blah blah and more blah blah blahblah more blah blah blah yes yes blah blah</PRE> This is my PRE code in style.css: PHP Code: PRE { BORDER-RIGHT: #2f6fab 1px dashed; PADDING-RIGHT: 1em; BORDER-TOP: #2f6fab 1px dashed; PADDING-LEFT: 1em; PADDING-BOTTOM: 1em; BORDER-LEFT: #2f6fab 1px dashed; COLOR: #000000; LINE-HEIGHT: 1.1em; PADDING-TOP: 1em; BORDER-BOTTOM: #2f6fab 1px dashed; BACKGROUND-COLOR: #f9f9f9; width: 90%; } PRE.yup { COLOR: #000000; FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif; FONT-SIZE: 12px; text-align: left; width: 80%; margin: 12px auto; } The PRE tag is in a table and i want the long text the same lenght as the short text, but i have no clue how to do it. Any ideas? I have a script that shows the latest lines from my chat. sometimes people will post a super long url or another super long thing without periods ie testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something-testing-something how can I make css break that up so the browser window won't scroll vertically? Hello, I posted this in the HTML forum too but didnt get any replies so maybe people in here know it. When you have a table cell with a width of 20%, and you put a very long string in it. Let's say 255 chars long, without spaces in between. The cell will then expand beyond the 20% that was specified. How can you prevent this and make sure the string is broken down and goes further on a next line in the cell when the 20% width is reached? thanks in advance I have a few div on my page and the ones that have long lines or URL's are expanding width-wise. Code: <div style="width: 300px;">MyVeryLongLineThatCanAndMostLikelyContainsURLs</div> I would like that the div keeps the same width, as the height is not a problem as the div contains other text, causing it to grow downwards anyway, and allow the line to break up with out causing any possible hyperlinks that are in the text to fail if clicked. what happens is that the div grow wider to allow the long line to show inside. When you first load the page, you get the impression that there isn't much, if anything to scroll down to. But if you try anyway, the long scrollbar button quickly collapses, revealing that indeed there is much more to scroll down to. Why is this? The page is three tables with about 7 rows each. And OF COURSE this works perfectly in Mozilla browsers. Guys, i've read a ton of posts here, and the quality of members is one of the best i've seen anywhere. so, i have high hopes for what you might suggest. Here's my deal: i have a table that is 254 pixels wide (you can see it at: (URL address blocked: See forum rules)/RSStest.php ) When text comes through the RSS feed that is wider than 254 pixels, the table border expands, and this throws off the formatting. If you check this link, it may not necessarily show the problem, but if you wait a while, when a long link comes through you'll see exactly what i'm talking about. I simply don't want the table to expand when long text comes through the RSS feed (which is long link strands, for the most part). I thought selecting "hidden" for overflow in the styles options would solve this, but it hasn't. Here are my CSS settings: .secondrssstyle { width: 254px; display: table-cell; text-decoration: none; overflow: hidden; position: relative; visibility: visible; } I can apply these styles to the table in the xsl file in Dreamweaver, but not the php file you actually see in the link i've posted. i don't think that's a big deal, b/c either way i can't get the tables to work. I seriously appreciate any help. Best regards. Anyone know of a good way to break up a long word from an element with a certain width? Say I have a word like wordddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd, I'd want it to show up properly. Here's the best I've come up with: Code: <html> <head> <style type="text/css"> div { background-color:#00FFFF; width:150px; overflow: hidden; } </style> </head> <body> <div> Longworddddddddddddddddddddddddddddddddddd </div> </body> </html> As you see, just cutting off the word isn't really ideal. Is there a way to auto-break up long words or something? Hi! Have been bashing my head against the wall with this one for a while now, so I thought maybe someone here could help me out a bit. Basicly, this sums up the issue: (sorry for the pure-text link, it didn't allow me to put up a propper one... >.<) http://img205.imageshack.us/my.php?image=cssiebug.png So, what I want is that the search field stays put, no matter how much text is entered into it. This works in all the other browsers, thought it's still a bit buggy, but I think I can fix that. Here is the code that should be of interest in this issue: Code: <div id="bannerContent"> <!--{{{--> <div id="logo"> <a href="<?PHP echo $home ?>" target="_self"></a> </div> <div id="search"> <form> <input type="text" class="searchField" name="uSearchQuery"> <input type="submit" class="searchSubmit" name="uSubmitQuery" value="" onFocus="this.blur()"> </form> </div> <!--}}}--> </div> Code: #bannerContent /*{{{*/ { width: 800px; height: 158px; } #logo /*{{{*/ { background: url("../images/layout/logo.png") no-repeat; width: 394px; height: 56px; position: relative; top: 51px; left: 24px; float: left; } /*}}}*/ #search /*{{{*/ { width: 331px; height: 32px; position: relative; top: 62px; left: 58px; display: inline; float: left; } .searchField { background: url("../images/layout/search_field_bg.png") no-repeat; width: 266px; height: 32px; border: none; outline: none; float: left; <?PHP if (!$agentIE && !$agentFF) echo 'padding-left: 10px;' . "\n"; else echo 'padding: 8px 0 0 10px;' . "\n"; ?> } .searchSubmit { background: url("../images/layout/search_button.png") no-repeat; width: 55px; height: 32px; margin-left: -10px; border: none; outline: none; cursor: pointer; float: left; } /*}}}*/ /*}}}*/ Thanks a bunch in advance! EDIT:: Simplier way to write the question ^.^ :: When I scroll off the menu/link onto the first link in the submenu it stays, but when I mvoe down to the next item in the submenu it disappears. (My drop down is vertically aligned on the left.) (bits of the code that relate to the menu) PHP Code: .btn1 { position: absolute; left: 165px; top: 200px; } .btn2 { position: absolute; left: 165px; top: 240px; } .btn3 { position: absolute; left: 165px; top: 280px; } .btn4 { position: absolute; left: 165px; top: 320px; } .btn5 { position: absolute; left: 165px; top: 360px; } .btn6 { position: absolute; left: 165px; top: 400px; } .btn7 { position: absolute; left: 165px; top: 440px; } .btn8 { position: absolute; left: 165px; top: 480px; } .link1 { position: absolute; left: auto; top: 240px; } .link2 { position: absolute; left: auto; top: 280px; } .link3 { position: absolute; left: auto; top: 320px; } .link4 { position: absolute; left: auto; top: 360px; } .link5 { position: absolute; left: auto; top: 400px; } .link6 { position: absolute; left: auto; top: 440px; } .link7 { position: absolute; left: auto; top: 480px; } .link8 { position: absolute; left: auto; top: 520px; } .link9 { position: absolute; left: auto; top: 560px; } #nav, #nav ul { padding: 0; margin: 0; list-style: none; } #nav a { display: block; width: 100px; } #nav li { width: 100px; } #nav li ul { position: absolute; width: 100px; left: -9999px; display: none; top: 0; z-index: 3; } #nav li:hover ul { display: block; left: 266px; z-index: 3; } #nav li:over ul { display: block; left: 266px; z-index: 3; } PHP Code: <ul id="nav"> <li><a href="HOBmain.htm"><img class="btn1" src="../mainbtn.gif" width="100" height="38" alt="MainBtn"></a></li> <li><a href="HOBmain.htm"><img class="btn2" src="../blogbtn.gif" width="100" height="38" alt="BlogBtn"></a> <ul> <li class="link1"><a href=""><img src="../mbtn.gif" alt="bMainBtn"></a></li> <li class="link2"><a href="#"><img src="../anmbtn.gif" alt="bAnimeBtn"></a></li> <li class="link3"><a href="#"><img src="../mgabtn.gif" alt="bMangaBtn"></a></li> <li class="link4"><a href="#"><img src="../gmebtn.gif" alt="bGameBtn"></a></li> <li class="link5"><a href="#"><img src="../bookbtn.gif" alt="bBookBtn"></a></li> </ul> </li> <li><a href="HOBmuse.htm"><img class="btn3" src="../musebtn.gif" width="100" height="38" alt="MuseBtn"></a> <ul> <li class="link2"><a href="HOBmuse.htm"><img src="../mbtn.gif" alt="mMainBtn"></a></li> <li class="link3"><a href="HOBmuse.htm"><img src="../pmbtn.gif" alt="mPoemBtn"></a></li> <li class="link4"><a href="HOBmuse.htm"><img src="../stybtn.gif" alt="mStoryBtn"></a></li> <li class="link5"><a href="HOBmuse.htm"><img src="../drmbtn.gif" alt="mDreamBtn"></a></li> </ul> </li> <li><a href="HOBodd.htm"><img class="btn4" src="../oddbtn.gif" width="100" height="38" alt="ComicBtn"></a> <ul> <li class="link3"><a href="HOBodd.htm"><img src="../mbtn.gif" alt="cMainBtn"></a></li> </ul> </li> <li><a href="HOBart.htm"><img class="btn5" src="../artbtn.gif" width="100" height="38" alt="ArtBtn"></a> <ul> <li class="link4"><a href="HOBart.htm"><img src="../mbtn.gif" alt="aMainBtn"></a></li> <li class="link5"><a href="HOBart.htm"><img src="../recbtn.gif" alt="aRecentBtn"></a></li> <li class="link6"><a href="HOBart.htm"><img src="../gaibtn.gif" alt="aGaiaBtn"></a></li> </ul> </li> <li><a href="HOBpic.htm"><img class="btn6" src="../picbtn.gif" width="100" height="38" alt="PicsBtn"></a> <ul> <li class="link5"><a href="HOBpic.htm"><img src="../mbtn.gif" alt="pMainBtn"></a></li> <li class="link6"><a href="HOBpic.htm"><img src="../recbtn.gif" alt="pRecentBtn"></a></li> </ul> </li> <li><a href="HOBfaq.htm"><img class="btn7" src="../faqbtn.gif" width="100" height="38" alt="FaqBtn"></a></li> <li><a href="HOBcon.htm"><img class="btn8" src="../contactbtn.gif" width="100" height="38" alt="ContactBtn"></a> </li> </ul> <script type="text/javascript" src="drop_down.js"></script> the "nav" is referring to a bit of js, and this is in my header. Also not sure if it's correct, but I can worry about that later. link: The Page |