CSS - Horizontal Alignment
Sorry if i repeat someone else's question, i've actually stumbled upon lots of solutions for this matter, but, as usual, there just seems to be no "only one" solution, so maybe someone here knows.
In the good old days if i wanted to center all kinds of stuff, i'd use <div align="center">all kinds of <stuff></stuff></div>. Now i visit the w3c site and see the beautiful "deprecated" word by the "align" property, so i guess they once again need us to bash our heads against the walls with the most stupid invention in mankind: css. So can someone tell me how to center div's content horizontally? And not just text, i mean images, other tables or other kinds of things. If i assume correctly: If i use text-align - this is meant for text only If i use margin: 0 auto - that would align the div itself and not the content and we would need to know its width So is there any normal solution to this? Similar TutorialsI have a horizontal list using <ul> but the last two items in the list i want aligned to the right of the page but how do i do this? PHP Code: <div id="menu"> <ul> <li>home</li> <li>browse</li> <li>artists</li> <li id="selected">collections</li> <li>news</li> <li>how to buy</li> <li>trade</li> <li>mailing list</li> <li>e-card</li> </ul> </div> above is my list WordPress 3.0.4, multisite network enabled, local installation with MAMP 1.9.4 (PHP 5.3.2) WordPress Theme: Twentyten (child) Browsers: FireFox 3.6.13, Safari 5.0.3 Problem: Have four divs within a container div. CSS validates. Moreover, the html & CSS do display without a hitch on a hand-coded website using HTML 4.01 Transitional//EN. They also display perfectly up at jsfiddle.net/EVErR. However, the same code in a WordPress Page is behaving unexpectedly: the four divs are floating left, one after the other, but stepped down so that they resemble a staircase. See screenshot at imgur.com/ufw2i. The CSS: /* div layout for displaying 4 small boxes horizontal alignment */ div.box-container { display: inline; margin: 0pt; padding: 0pt; width: 640px; background-color: rgb(229, 231, 225); position: relative; float: left; overflow: hidden; } div.small-box { border: 1px solid rgb(153, 51, 102); margin: 20px 0px 20px 15px; padding: 0.325em; float: left; display: inline; vertical-align: top; background-color: rgb(255, 244, 227); width: 128px; line-height: 0.85em; max-height: 8em; min-height: 8em; position: relative; } HTML: <div class="box-container"> <div class="small-box">SOME TEXT AND AN IMAGE</div> <div class="small-box">SOME TEXT AND AN IMAGE</div> <div class="small-box">SOME TEXT AND AN IMAGE</div> <div class="small-box">SOME TEXT AND AN IMAGE</div> </div> What am I missing here? Help much appreciated! Hello all, I am trying to make a horizontal nav bar using a list. Everything was going good until I tried to add an image (essential a line) to seperate each <li>. When I did this, the height of the nav bar expanded and it moved the entire list down about 15 pixels or so. I am attaching an image before I added the image and after I added the image to show. Here is my css code for before I add the image: PHP Code: #navbar { height:37px; line-height:33px; padding: 2px 0 0 10px; vertical-align:top; background: url(images/linkbarbg1.png) repeat-x; font-family: Tahoma, Georgia, "Times New Roman", Times, serif; font-size: 18px; color: #FFFFFF; } #navbar ul { vertical-align:top; margin:0; padding:0; border: 0px solid #000000; } #navbar ul li { display: inline; } #navbar ul li a { display: inline; text-decoration: none; padding-top: 5px; padding-bottom: 4px; padding-right: 10px; padding-left: 10px; color:#FFFFFF; } #navbar ul li a:hover { height: 31px; background:url(images/linkbarbg1hover.png) repeat-x top left; background-color: #FF3300; } And HTML: PHP Code: <div id="main"> <div class="leftshadow"> <div class="rightshadow"> <div id="header"><img src="images/logo1.png" /></div> <div id="navbar"> <ul> <li><a href="#">Milk</a></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> <li><a href="#">Vegetables</a></li> <li><a href="#">Fruit</a></li> </ul> </div> </div> </div> And here is what it looks like: My CSS Code is the same for after, here is my HTML code for after: PHP Code: <div id="main"> <div class="leftshadow"> <div class="rightshadow"> <div id="header"><img src="images/logo1.png" /></div> <div id="navbar"> <ul> <li><a href="#">Milk</a></li> <li><img src="images/linkbarseperator1.png" /></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> <li><a href="#">Vegetables</a></li> <li><a href="#">Fruit</a></li> </ul> </div> </div> </div> and here is what is looks like: Is there a way to fix this? UPDATE I have noticed the same thing happens even when it is not a list. Therefore, it must be due to some other factor...does anyone have any ideas? HI Guys, I'm trying to create some CSS to contain an image gallery. A query runs which grabs all the images for a certain item/article. I then output the query as a loop, and it populates a div with images. It works pretty good, but if one image is bigger than the others, it throws off the alignment. How can I force each row of photos to be horizontally even? You can see the output results here http://details.at/photo_test.cfm <!--- Query ---> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <style> #maindiv { padding:0 0 1em 2em; width:550px; float:left; } div.img { margin:3px; height:auto; width:auto; float:left; text-align:center; } </style> </head> <body> <DIV id="maindiv"> <H2>Photos</H2> <CFOUTPUT QUERY="photo_file_info"> <div class="img"> <a href="http://google.com" target=new> <img src="http://details.at/imagehost/classifieds/aircraft/139/s_#photo_file#"> </a> </div> </CFOUTPUT> </DIV> </body> </html> Hi this is my first post. I'm having trouble making a horizontal navbar with a picture background. here is the vertical menu. http://school(dot)timswildwackyemporium(dot)com/NewMouseOver/navtest.html replace (dot)s with period I want to make the buttons next to each other, but with about 10px space in between them. Thanks. I've been grappling with this for a long while now. I pretty much have it working, except for the life of me I cannot get the drop down menus to appear under the corresponding link. position: absolute makes the menus always appear off to the left. Does anyone know what the secret is to this? Code: <div id="nav_wrapper"> <div id="nav_bar"> <div id="nav_content"> <ul id="nav_ul"> <li><a href="/">Home</a></li> <li><a href="/forum/">Forum</a> <div class="nav_subcontent"> <ul> <li><a href="/forum/search.php">Search</a></li> <li><a href="/forum/memberlist.php">Members</a></li> </ul> </div> </li> <li><a href="#">A link without a menu</a></li> </ul> </div> </div> </div> Code: /* Wrapper */ #nav_wrapper { clear: both; } /* Bar */ #nav_bar { background: url('images/nav_swish_fade.jpg'); background-repeat: repeat-x; height: 36px; } /* All the buttons within the bar, the middle portion */ #nav_content { display: inline; margin: 0 auto; text-align: center; background: #fff; height: 36px; } /* Entire unordered list */ #nav_ul { list-style: none; position: relative; } /* Top level unordered list */ #nav_content ul>li { display: block; } /* Top level unordered list links */ #nav_content ul>li a { display: block; float: left; padding: 9px; margin-left: 2px; margin-right: 2px; } /* Menus */ .nav_subcontent { display: none; position: absolute; background: #222; margin-top: 8px; } /* Menu link */ #nav_content .nav_subcontent a { display: block; padding: 9px 20px 9px 0; margin-left: -5px; text-align: left; min-width: 100px; } /* Show menus */ #nav_content ul>li:hover .nav_subcontent { display: block; } PHP Code: echo "<div class=\"tbody2\">"; echo "<div class=\"client\">Client<div class=\"clientname\">Client Name</div></div>"; echo "</div>"; Using the above code it displays Client on top of Client Name. How do I make Client name appear to the right of Client using only css? Hello all, I've just recently began adventuring into the world of CSS and am in need of some help. I've created a horizontal nav menu that works perfectly fine in FF, Opera, etc. but refuses to listen in IE. The drop-down menu is positioned over to the right in IE, while in every other browser the menu is positioned (correctly) centered. I'd post a url but I'm just working offline on my computer so I don't have one to provide :\. I appreciate any advice you guys got for me. HTML (probably only the commented nav bar section is relevant) 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> Rutgers Libertarians | Home </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <style type="text/css" title="BasicStyle" media="screen"> @import "test.css"; </style> </head> <body> <div id="screen"> <div id="header"> <img src="header.jpg" width="1000" height="145" alt="banner" /> </div> <!--Navbar--> <ul id="navbar"> <li><a href="test.html">Home</a> </li> <li><a href="">Meetings</a> <ul> <li><a href="#meetings">Regular Meetings</a></li> <li><a href="#events">Events</a></li> <li><a href="#photo">Photos</a></li> </ul> </li> <li><a href="">Invisible Hand</a> <ul> <li><a href="#hand">Overview</a></li> <li><a href="#articles">Articles</a></li> </ul> </li> <li><a href="">About Us</a> <ul> <li><a href="#liber">Libertarianism</a></li> <li><a href="#board">Executive Board</a></li> <li><a href="#contact">Contact Us</a></li> </ul> </li> <li><a href="">Links</a> <ul> <li><a href="#main">NJ Party</a></li> <li><a href="#mutt">National Party</a></li> </ul> </li> </ul> <!--Sidebar--> <div id="leftbar"> <h3>News</h3> <ul id="leftlinks"> <li><a href="#news1">News 1</a></li> <li><a href="#news2">News 2</a></li> <li><a href="#news3">News 3</a></li> </ul> <h3>Site Map</h3> <ul id="rightlinks"> <li><a href="test.html">Home</a></li> <li><a href="test.html">Meetings</a></li> <li><a href="test.html">Invisible Hand</a></li> <li><a href="test.html">About Us</a></li> <li><a href="test.html">Links</a></li> </ul> </div> <!--Main Content--> <div id="main"> <div id="title"> <h1>Rutgers Libertarians</h1> <p>The Rutgers Libertarians are an organization dedicated to bringing the philosophy of liberty to Rutgers University. We welcome any who believe in any form of Libertarianism or just want to know what Libertarianism is.</p> </div> <div id="news"> <div class="news"> <h2><a name="news1">Libertarian Party Takes White House</a></h2> <img src="white.jpg" width="100" height="100" alt="white" /> <p>In an unprecedented turn of events the Libertarian Party stormed the gates of the white house Tuesday, placing Ron Paul as the head of government. Paul has promised an immediate withdrawal from Iraq, the dissolution of the Federal Reserve, and the holding accountable of failing banks.</p> <div class="comments"> <a href="">comments</a> </div> </div> <div class="news"> <h2><a name="news2">Pot of Brownies Event</a></h2> <img src="brownie.jpg" width="100" height="100" alt="brownie" /> <p>The Rutgers Libertarians held their annual Pot of Brownies event on Wednesday. There was a record 10,000 students in attendance and over 12,000 brownies were consumed - pot free. The message of decriminalizing drugs really seems to be catching on.</p> <div class="comments"> <a href="">comments</a> </div> </div> <div class="news"> <h2><a name="news3">Invisible Hand Remains Invisible</a></h2> <img src="invisible.jpg" width="100" height="100" alt="invisible" /> <p>The Rutgers Libertarian publication, <i>The Invisible Hand</i> has been delayed once again. Though the club president has reported recieving articles, no one seems to know why the newspaper never seems to come out.</p> <div class="comments"> <a href="">comments</a> </div> </div> </div> </div> <!--Main end--> </div> <!--Screen end--> </body> </html> CSS Code: /* CSS Formatting */ body { text-align: center; background: #153464; } #main { background: url(bg.gif); border: 1px black solid; padding: 10px; } img { border: 1px solid black; } h1 { font-family: "Lucida Sans", "Lucida Grande", Verdana, Sans-serif;; font-size: 22px; font-weight: 400; text-transform: uppercase; letter-spacing: 4px; color: #ACACAC; margin-bottom: 25px; border-bottom: 1px solid #ACACAC; } h2 { font-family: "Lucida Sans", "Lucida Grande", Verdana, Sans-serif; font-size: 16px; font-weight: 400; text-transform: uppercase; letter-spacing: 4px; text-align: left; color: #ACACAC; border-bottom: dotted 1px #ACACAC; margin-bottom: 0px; } h3 { font-family: "Lucida Sans", "Lucida Grande", Verdana, Sans-serif; font-size: 16px; font-weight: 400; text-transform: uppercase; letter-spacing: 2px; text-align: left; color: white; border-bottom: solid 1px white; margin: 10px 0 0 3px; } p { font-family: "Rockwell", "Lucida Sans", "Lucida Grande", Verdana, Sans-serif; font-size: 12px; font-weight: 400; color: white; } #title { margin: 10px; border: black solid 1px; background: #30538D; padding: 10px; } #news { margin: 10px; border: black solid 1px; background: #30538D; padding: 10px; } #screen { /* top, right, bottom, left */ width: 1000px; margin: 20px auto 0 auto; } #main { width: 810px; margin: 0 auto 70px auto; float: right; } .news { height: 150px; } .news p { text-align: justify; } .news img { float: left; margin: 13px 15px 0 0; border: 1px solid black; } #links a { color: #EF8861; border: 0; padding: 10px 10px 0 0; } #links a:visited { color: #EF8861; } #links a:hover { color: #F8C473; } #leftbar { display: block; width: 150px; border: 1px solid black; float: left; text-align: left; background: url(bg3.jpg); } #leftbar p { padding-left: 10px; } #leftbar a, #leftbar ul { font-family: "Lucida Sans", "Lucida Grande", Verdana, Sans-serif; font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 4px; display: block; width: 150px; text-decoration: none; color: black; list-style: none; text-align: center; } #leftbar ul { position: relative; left: -41px; /* ** Copy this for other problem areas ** */ } #leftbar a:link, #leftbar a:visited { background: white; border: 1px solid black; margin-bottom: 10px; padding: 3px 0 3px 0px; } #leftbar a:focus, #leftbar a:hover, #leftbar a:active { background: #30538D; border: 1px solid black; margin-bottom: 10px; padding: 3px 0 3px 0; } .comments { text-align: right; } .comments a:link, .comments a:visited { position: relative; top: 50px; color: white; padding: 3px 0 3px 0px; text-decoration: none; } .comments a:focus, .comments a:hover, #leftbar a:active { margin-bottom: 10px; padding: 3px 0 3px 0; text-decoration: underline; } /* Nav Bar */ #navbar, #navbar ul { /* Remove default list formatting; Inline replicates problem in IE */ padding: 0; margin: 0; list-style: none; } #navbar li { /* Make navbar appear horizontally */ float: left; width: 175px; padding: 10px 0 10px 25px; color: white; font-family: "Lucida Sans", "Lucida Grande", Verdana, Sans-serif; font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: 4px; } #navbar li ul { /* Hide second level when not hovered */ width: 175px; position: absolute; left: -999em; } #navbar li:hover ul{ left: auto; background:url(bg3.jpg); border: 1px solid black; padding: 5px 0 5px 4px; margin-top: 5px; margin-left: -5px; /* -90 for IE */ } #navbar a { width: 175px; display: block; text-decoration: none; color: white; font-family: "Lucida Sans", "Lucida Grande", Verdana, Sans-serif; font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: 4px; } #navbar li ul li { /* Make list items smaller */ text-align: left; } #navbar li:hover ul li { border: none; padding: 4px; } #navbar a:hover { text-decoration: underline; } #leftbar { clear: both; } Thanks for your help! Hi, I have the following menu that is currently laid out with a table: http://www.ianarmstrong.com/menutest/ I want to switch this to be styled in CSS somehow. I've looked at using a styled unordered list to do this, but that doesn't seem like the best idea as each image in my menu is different. Thus I can't have 5 different <li> elements, each with a different bg image. I need a way to handle the 5 different images, and have a mouseover effect as well. Could someone offer some direction on this problem? Hey guys nice forums.....am a css noobie i wanna know one thing how do i make a div stretch horizontally 100% , basically i want my website to be divided into 2 colors black and white the lower part would be black and the upper part would be white , now am not using a div container as i read through previous topics before so am using 2 divs as follows <div id="White">White area</div> <div id="Black">Black area</div> when i preview in IE i see the colors as i want but the divs do not stretch 100% as i said in the css. how do i do it ? hope i made myself clear on this I've been working on a site and have a problem with the horiztonal positioning of a div. At http://www.alphaworks.co.uk/problems/nicewag1/ I would like the position of the div with the id "page_footer" to move to the leftmost position. Can someone point out the mistake I'm making? Thanks, Geoff Hi, I'm trying to make a horizontal list using li tags. I got the text to align horizontally but the bullet icons I want to use (or even when I try with the default bullets) don't appear. Can anyone help me out with this? Here's the code : Code: #onlineToolsNav ul { margin-top: 0px; margin-bottom : 0px; margin-left : 5px; padding: 0px; line-height: 25px; white-space: nowrap; display : inline; } #onlineToolsNav li { display: inline; list-style-image: url(onlineArrow.jpg); list-style: url(onlineArrow.jpg); } #onlineToolsNav li:before { content: url(onlineArrow.jpg); } #onlineToolsNav li.first:before { content: " "; } <div id="onlineToolsNav"> <ul> <li><a href="link1.html">link1</a></li> <li><a href="link2.html">link2</a></li> <li><a href="link3.html">link3</a></li> <li><a href="link4.html">link4</a></li> <li><a href="link5.html">link5</a></li> <li><a href="link6.html">link6</a></li> </ul> </div> Thanx Olografix I am trying to create a navigation menu for a page using images i have sliced in photoshop and I now need to put the images all on a 900px wide line and link them to the appropiate pages. When i put the images next to each other i end up with a gap. The only way I have found to solve the problem is to leave the img src all on the same line. I'm sure this isn't the best way to do it and it is throwing out the div below. Ideas anyone? Code: Code: Original - Code <div id="nav"> <img id="home" src="images/menu/home.gif" alt="" /><img id="about" src="images/menu/about.gif" alt="" /><img id="wedding" src="images/menu/wedding.gif" alt="" /><img id="corporate" src="images/menu/corporate.gif" alt="" /><img id="occasions" src="images/menu/occasions.gif" alt="" /><img id="contact" src="images/menu/contact.gif" alt="" /> </div> <div id="nav"> <img id="home" src="images/menu/home.gif" alt="" /><img id="about" src="images/menu/about.gif" alt="" /><img id="wedding" src="images/menu/wedding.gif" alt="" /><img id="corporate" src="images/menu/corporate.gif" alt="" /><img id="occasions" src="images/menu/occasions.gif" alt="" /><img id="contact" src="images/menu/contact.gif" alt="" /> </div> Jake Thanks for taking the time to read my question. I FF v.2 and IE v.7 In FF I don't get a horizontal scroll bar, which is what I want, but in IE I do. I can't figure out why. The horizontal scroll bar happens here [id="ListOfItemTitles"]. 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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <title>For Sale</title> <link href="Matt.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="Matt.js"></script> </head> <body onload="createArray();createArrayDVD()"> <div class="LeftNavMainOut"> <div class="LeftNavMainIn"> <div class="LeftNavContentTitle"> Select category below to view available inventory </div> <div class="LeftNavContentHolder"> <div class="LeftNavContent"> <!--<a class="Nav" href="#" onClick="ChangeTitle('CD \'s','CD')">CD's</a>--> <a class="Nav" href="#" onClick="ChangeTitle('CD \'s','CD')">CD's</a> </div> <div class="LeftNavContent"> <a class="Nav" href="#" onClick="ChangeTitle('DVD \'s','DVD')">DVD's</a> </div> </div> </div> </div> <div class="ItemListMain"> <div class="ItemListTitle" id="ListOfItemTitles"></div> <div class="roundtop"><img class="corner" src="TopLeft3.png" alt="" style="display: none" /></div> <div class="ItemListContent" id="ListOfStuff"></div> <div class="roundbottom"><img class="corner" src="BottomLeft3.png" alt="" style="display: none" /></div> </div> <div> <iframe src="CD.txt" id="CDIFrame" style="height:0px;width:0px;border:0;overflow:hidden;"></iframe> <iframe src="DVD.txt" id="DVDIFrame" style="height:0px;width:0px;border:0;overflow:hidden;"></iframe> </div> <div class="InfoContainer"> <div class="CoverPicMain"><img id="PicutreID" class="CoverPictures" src="Covers/NoCover.png" /></div> <div id="InformationID" class="ItemDetails">CD and DVD Information</div> </div> </body> </html> CSS: Code: html, body { height: 100%; width: 100%; margin: 0px; padding: 0px; background-image: url(background.jpg); background-repeat: no-repeat; background-position: center center; background-color: #000000; } .LeftNavMainOut { /*background-color: red;*/ float: left; display: inline; /*height: 600px;*/ height: 100%; width: 170px; margin-right: 100px; margin-left: 80px; padding-left:19px; background-image: url(LeftNavBorder.png); background-repeat: repeat-y; background-position: top left; } .LeftNavMainIn { /*background-color: pink;*/ float: left; height: 100%; width: 100%; background-image: url(LeftNavBorder.png); background-repeat: repeat-y; background-position: top right; } .LeftNavContentTitle { text-align: center; font-size: 20px; color: white; width: 150px; border-bottom: 4px double blue; margin-top: 10px; } .LeftNavContentHolder { margin-top: 100px; padding-left: 2px; } .LeftNavContent { background-color: aqua; width: 140px; float: left; border: 2px solid CCCCCC; text-align: center; font-size: 20px; margin-bottom: 10px; } .ItemListTitle{ font-size: 25px; text-align: center; width: 100%; height: 25px; margin-bottom: 5px; } .ItemListMain { /*background-color: #99FF33;*/ margin-top: 100px; float: left; width: 180px; } .ItemListContent { background-color: #0033CC; padding-left: 8px; padding-right: 8px; height: 300px; overflow: auto; display:block; } .InfoContainer { width: 265px; float: right; /*background-color: green;*/ margin-right: 100px; margin-top: 130px; /*100px like ItemListMain, 25px like ItemListTitle, 5px like ItemListTitle*/ padding: 0px; overflow: hidden; } .CoverPicMain { /*background-color: gray;*/ width: 150px; height: 150px; float: right; margin-right: 45px; } .CoverPictures { width: 150px; height: 150px; } .ItemDetails { /*background-color: orange;*/ width: 260px; height: 146px; float: right; margin: auto; padding: 2px 2px 2px 3px; overflow: hidden; color: white; } .ItemDetailsArtist { float: left; width: 100%; } .ItemDetailsTitle { float: left; width: 100%; } .ItemDetailsType { float: left; width: 100%; } .ItemDetailsCost { float: left; width: 100%; } .ItemDetailsWidescreen { float: left; width: 100%; } .ItemDetailsActors { float: left; width: 100%; } .ItemDetailsRating { float: left; width: 100%; } img.corner { height: 20px; width: 160px; border: none; display: block !important; } .roundtop { background: url('TopRight.png') no-repeat top right; /*background-color: #0033CC;*/ } .roundbottom { background: url('BottomRight.png') no-repeat top right; /*background-color: #0033CC;*/ } .Nav { display: block; width: 100%; } .ListStuff { display: block; width: 100%; border-bottom: 1px solid #CCCCCC; } a.Nav:link { color: #000000; text-decoration: none; } a.Nav:visited { color: #000000; text-decoration: none; } a.Nav:hover { color: #000000; text-decoration: underline; background-color: #0066FF; } a.Nav:active { color: #000000; text-decoration: none; } a.ListStuff:link { color: #ffffff; text-decoration: none; } a.ListStuff:visited { color: #ffffff; text-decoration: none; } a.ListStuff:hover { color: #ffffff; text-decoration: underline; background-color:#0066FF; } a.ListStuff:active { color: #ffffff; text-decoration: none; } JS: Code: var TheCDTitles=new Array(); var TheDVDTitles=new Array(); function ChangeTitle(WhichDesc, FrameName) { TheCDTitles='' TheDVDTitles='' document.getElementById("ListOfItemTitles").innerHTML = "<strong><font color=#ffffff>" + WhichDesc + "</font></strong>"; if (FrameName=='CD') { for (x in itemsArray) { TheCDTitles = TheCDTitles + '<a href="#" class="ListStuff" id="CD" + i + onmouseover="ShowInfoAndPic(' + x + ',' + x + ')">' + itemsArray[x].Artist + '</a>'; } document.getElementById("ListOfStuff").innerHTML = TheCDTitles; } if (FrameName=='DVD') { for (x in itemsArrayDVD) { TheDVDTitles = TheDVDTitles + '<a href="#" class="ListStuff" id="DVD" + i + onmouseover="ShowInfoAndPicDVD(' + x + ',' + x + ')">' + itemsArrayDVD[x].Title + '</a>'; } document.getElementById("ListOfStuff").innerHTML = TheDVDTitles; } } //*******************CD****************************** var itemsArray=new Array(); var x function createArray() { x=0 var data=getCDContents(); var items=data.split('\n'); //splits the data in retreived from getContents() by line var stats; for (var i=0; i<items.length; i++) { x++ stats=items[i].split(','); //This is the line that determines what separates values in a line itemsArray[i]={Artist:stats[0], Title:stats[1], Type:stats[2], Cost:stats[3], Pictu stats[4]}; //This is the line that gives a description to each value in a line. The values in the text file need to be in this order } } function getCDContents() { // gets data from the iFrame which is hidden (height= 0px, width=0px) in PictureScan.html var iFrame=document.getElementById('CDIFrame'); var INdata=""; if (iFrame.contentDocument) INdata=iFrame.contentDocument.defaultView.document.body.innerHTML; if (iFrame.contentWindow) INdata=iFrame.contentWindow.document.body.innerHTML; INdata=INdata.replace('<pre>','').replace('</pre>','').replace('<PRE>','').replace('</PRE>',''); return(INdata); } function ShowInfoAndPic(PicID,InfoID){ var Test Test = null document.getElementById("InformationID").innerHTML = '<div class="ItemDetailsArtist">Artist: ' + itemsArray[InfoID].Artist + '</div>' + '<div class="ItemDetailsTitle">Title: ' + itemsArray[InfoID].Title + '</div>' + '<div class="ItemDetailsType">Type: ' + itemsArray[InfoID].Type + '</div>' + '<div class="ItemDetailsCost">Cost: ' + itemsArray[InfoID].Cost + '</div>'; if (Test == itemsArray[PicID].Picture){ document.getElementById('PicutreID').src = 'Covers/NoCover.png'; } else { document.getElementById('PicutreID').src = 'Covers/' + itemsArray[PicID].Picture; } } //*******************DVD****************************** var itemsArrayDVD=new Array(); function createArrayDVD() { var dataDVD=getCDContentsDVD(); var itemsDVD=dataDVD.split('\n'); //splits the data in retreived from getContents() by line var statsDVD; for (var iDVD=0; iDVD<itemsDVD.length; iDVD++) { statsDVD=itemsDVD[iDVD].split(','); //This is the line that determines what separates values in a line itemsArrayDVD[iDVD]={Title:statsDVD[0], Widescreen:statsDVD[1], Actors:statsDVD[2], Type:statsDVD[3], Rating:statsDVD[4], Cost:statsDVD[5], Pictu statsDVD[6]}; //This is the line that gives a description to each value in a line. The values in the text file need to be in this order } } function getCDContentsDVD() { // gets data from the iFrame which is hidden (height= 0px, width=0px) in PictureScan.html var iFrameDVD=document.getElementById('DVDIFrame'); var INdataDVD=""; if (iFrameDVD.contentDocument) INdataDVD=iFrameDVD.contentDocument.defaultView.document.body.innerHTML; if (iFrameDVD.contentWindow) INdataDVD=iFrameDVD.contentWindow.document.body.innerHTML; INdataDVD=INdataDVD.replace('<pre>','').replace('</pre>','').replace('<PRE>','').replace('</PRE>',''); return(INdataDVD); } function ShowInfoAndPicDVD(PicIDDVD,InfoIDDVD){ var TestDVD TestDVD = null document.getElementById("InformationID").innerHTML = '<div class="ItemDetailsArtist">Title: ' + itemsArrayDVD[InfoIDDVD].Title + '</div>' + '<div class="ItemDetailsWidescreen">Widescreen (x=Yes): ' + itemsArrayDVD[InfoIDDVD].Widescreen + '</div>' + '<div class="ItemDetailsActors">Actors: ' + itemsArrayDVD[InfoIDDVD].Actors + '</div>' + '<div class="ItemDetailsType">Type: ' + itemsArrayDVD[InfoIDDVD].Type + '</div>' + '<div class="ItemDetailsRating">Rating: ' + itemsArrayDVD[InfoIDDVD].Rating + '</div>' + '<div class="ItemDetailsCost">Cost: ' + itemsArrayDVD[InfoIDDVD].Cost + '</div>'; if (TestDVD == itemsArrayDVD[PicIDDVD].Picture){ document.getElementById('PicutreID').src = 'Covers/NoCover.png'; } else{ document.getElementById('PicutreID').src = 'Covers/' + itemsArrayDVD[PicIDDVD].Picture; } } text doc for the CD iFrame Save this as CD.txt in the local folder Quote: 3 Doors Down,Away From The Sun,Rock,$5.00 3 Doors Down,The Better Life,Rock,$5.00 Adema,Insomniac's Dream,Rock,$5.00 Aerosmith,Get A Grip,Rock,$5.00 AFI,Sing The Sorrow,Rock,$5.00 Alice In Chains,self titled,Rock,$5.00 Alice In Chains,Dirt,Rock,$5.00 Alien Ant Farm,ANThology,Rock,$5.00 Thanks so much. Brad Hi ppl I'm trying to figure out how to do the following list, with CSS Is there any way that the boxes can accomodate themselves based on the width of their container's space? I mean, if the width of the site is reduced, maybe some box from the 1st row will go down, and so... Thanks I don't have an external webserver so i'll explain as best I can. I have a left and right section of my webpage each with their own background. The problem is a white gap between to the two backgrounds. I set the margin and padding on everything to 0 and it has no effect. This occurs in IE and FF. PHP Code: <html> <head> <style> body {margin: 0; padding: 0;} .left {float: left; background-image: url('background_left.jpg'); height: 100%; width: 300px; background-repeat: no-repeat; background-attachment: fixed; margin: 0; padding: 0;} .right {background-image: url('background_right.jpg'); background-repeat: repeat-x; height: 100%; margin: 0; padding: 0;} .menu {} .content {} </style> </head> <body> <div class="left"> <div class="menu"> </div> </div> <div class="right"> <div class="content"> </div> </div> </body> </html> I think I have the basics down to making my ul navigation list display as a nav bar. The rules I am using are
Code: div#navigation { background: #7799aa; color: #ffffff; margin: 4px 0 0 0; } div#navigation ul { list-style-type: none; margin: 0; padding: 8px; } div#navigation ul li { margin-right: 50px; width: 200px; display: inline; } div#navigation ul li a { color: #ffffff; width: 400px; } div#navigation ul li a:hover { background: #255599; } and the corresponding html Code: <div id="navigation"> <ul> <li><a href="/" title="The Company">Company</a></li> <li><a href="/" title="Our Solutions">Projects</a></li> <li><a href="/" title="What We Do">Services</a></li> <li><a href="/" title="Contact Us">Contact</a></li> <li class="last"><a href="/" title="What people are saying">Testimonials</a></li> </ul> </div> <!-- navigation --> Now, the problem is that I am trying to make the links seem like "buttons" or blocks. I cannot get them to a) have a width; or b) expand to the width of the list item (which I cannot give a specified width to either). I am still working with the design in firefox so I haven't ventured into getting it to work in IE. The XHTML is completely valid as is the rest of the stylesheet. I can post more if necessary, but does anyone have a bone? |