CSS - Multi-platform Font??
Similar TutorialsHi all, Just made a tables site runs oke on a pc but not on a mac. So now i want to create a mac-css. How can i include the right css-file based on an user platform????? Javascript or php?? Right up front, here's the CSS/markup I am concerned about: http://www.triple-bypass.net/testpage.htm http://www.triple-bypass.net/testpage.css It consists of a simple div with a colored background, and a couple anchor elements sitting on top of it. The anchors are treated as blocks, making this a nice little menu. The problem is that multiple platforms are displaying the anchor boxes in different places. Right now, it looks fine in Firefox 1.5.0.6 on WindowsXP. The anchor boxes stick up about 2 pixels in Firefox 1.5.0.6 on Mac OSX Tiger. And the anchor boxes stick down about 3 pixels in Firefox 1.5.0.6 on Linux. Here's a screenshot from Firefox on Linux: URL (Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060808 Fedora/1.5.0.6-2.fc5 Firefox/1.5.0.6 pango-text) My guess is that each platform is setting a different baseline for the anchor text, and growing the padding box around it from there. The "top" value that works on Windows, therefore, does not work on OSX or Linux. The simplest 'solution' would seem to be "Forget Linux and OSX, they're of no concern in the Windows world". However, as an alternative OS advocate, this is something I cannot do. I'm not too concerned about supporting other browsers, but supporting one browser across platforms is important to me. So has anyone had any experience with this? Is there a way to fix it? Or a hack to get around it? HTML Code: <div id="nav"> <ul> <li class="first"><a title="#" href="#">About Company</a></li> <li><a title="#" href="#">RRR News</a></li> <li><a title="#" href="#">Apartment Communities</a></li> <li><a title="#" href="#">Commercial Properties</a></li> <li><a title="#" href="#">Current Developments</a></li> <li class="last"><a title="#" href="#">Resident Login</a></li> </ul> </div> CSS Code: /*** Main Navigation Styling ***/ #nav { border-top: 1px solid #897409; border-bottom: 1px solid #897409; background:#fff url(../images/nav_off_back.jpg) repeat-x center; height: 29px; } #nav ul{ font-size: 17px; margin:0; float:left; text-align:center; width:100%; } #nav li { display:inline; margin:0; float:left; list-style: none; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; min-height: 27px; height: 27px; line-height:27px; padding:1px 0; } #nav li.first { background:url(../images/nav_bars.gif) left center no-repeat; padding-left:2px; _margin-left:24px; } #nav li.first a, #nav li.first a:link{ border-left:0; } #nav li.last { border-right:1px solid #fff; } #nav li a { color: #000; text-decoration: none; text-align:center; min-height: 27px; height:27px; padding:6px 17px 6px 17px; border-right:1px solid #b49f36; border-left:1px solid #fff; } #nav li a:hover { text-align:center; background: url(../images/nav_on_back.jpg) repeat-y center; color:#fff; min-height:27px; height: 27px; padding:6px 17px 6px 17px; } This code produces a centered horizontal navigation menu in FireFox Mac and IE6 PC. However, in FireFox PC the whole menu is shifted a bit to the right off-center (about 15 px). In IE7 PC, the menu sits on the left and is not centered at all. I am willing to use a browser sniffer to fix the IE7 problem, but I'm not sure what to do for Firefox. The PC and Mac versions of Firefox usually play nice, but not this time. I'd rather not use both a platform AND browser sniffer, but I'm running out of ideas. The addition of a pixel-specific line-height for #nav li { helped some earlier issues, but did not fix them all. Having an odd rendering problem involving centering content in a fixed-width right hand column that lies within a fixed width centered master content div. Take a look at the template he http://www.ipfwcommunicator.org/devindex.php At first I tried to center the content using align="center" in the HTML markup, which I know is a no-no, so I'm not too sad it didn't work. I then tried {margin-left: auto; margin-right: auto;}, thinking it would work in IE as it does with tables, but it did not. Both of these attempts worked worked with most modern browsers (Moz/Firefox/Safari/NN7) but failed on MSIE5/Mac and IE6/Win. Nice and compliant, and I would be happy in a perfect world, but alas, 90% of my readers use a (vastly) imperfect browser. I decided to get a bit more professional and utilize CSS positioning, setting the DIVs that hold the content boxes (i.e., Weather/Search/etc.) as {position: relative; left: 15px;}This also worked in most browsers, but oddly enough on IE5 Mac (and assume IE6 win although I didn't have a chance to test) the boxes centered but the tables inside the weather/search boxes that allow for cross-platform formating jutted out the side. Lastly, and this is the current solution, since the column is fixed width and the boxes are fixed width, I used the "ice" solution of dividing the remaining margin by two, and setting margin-left: equal to that. In this case: {margin-left: 15px;} Oddly enough this works FINE on everything, even IE5/Mac, but doesn't work on IE6/Windows, which instead results in what appears to be 5 or 6px more than the defined 15px. Compare here between Firefox and IE6 and you'll see it. And CSS is here So the question: What IS the best way to center up those boxes in that column? This is my first major CSS undertaking, having worked with nested tables up until now, so any pointers on my bad markup will be gladly accepted Thanks in advance, Aiden hello. I am currently using a simple horizontal top menu with a vertical drop down. I would like to change the vertical drop down to be horizontal, multi column, and should accomodate more than one line, if possible. The example I'm going for is used as top navigation he nfl - baltimore ravens home page and he ge home page Here is the code I'm using currently (would like it to be all CSS). #### ul#mainNavigation { padding-left:185px; } ul#mainNavigation li { padding:0 16px; float: left; display:inline; position: relative; list-style: none; color:White; _width:1px; } ul#mainNavigation li.Seperator { padding:0px; _width:1px; } ul#mainNavigation li.over { background-color:white; } ul#mainNavigation li.over a { color:Red; } ul#mainNavigation li a { color:White; text-transform:uppercase; text-decoration:none; font-weight:bold; display:block; } ul#mainNavigation a:hover { color: Red; } ul#mainNavigation li a { display: block; } ul#mainNavigation li p { height:19px; } ul#mainNavigation li ul { display: none; position: absolute; background-color:Black; opacity:.8; filter: alpha(opacity=80); -moz-opacity: 0.8; margin-left:-16px; } ul#mainNavigation li.over ul { display: block; z-index:999; } ul#mainNavigation li.over ul li { float: none; background:none; border:none; white-space:nowrap; padding:0px; } ul#mainNavigation li.over ul li a { color: white; padding:5px; border-bottom:solid 1px black; } ul#mainNavigation li.over ul li a:hover { background: #3d1f6e; color: white; } ~~~~~~~ HTML ~~~~~~~~~~~~~~ <ul id="mainNavigation"> <li> <p><a href="Mainlink1.html">Mainlink1</a></p> <ul> <li><a href="link2.html">LINK 2</a></li> <li><a href="link3.html">LINK 3</a></li> <li><a href="link4.html">LINK 4</a></li> <li><a href="link5.html">LINK 5</a></li> <li><a href="link6.html">LINK 6</a></li> <li><a href="link7.html">LINK 7</a></li> </ul> </li> <li> <p><a href="Mainlink2.html">Mainlink2</a></p> <ul> <li><a href="link2.html">LINK 2</a></li> <li><a href="link3.html">LINK 3</a></li> <li><a href="link4.html">LINK 4</a></li> <li><a href="link5.html">LINK 5</a></li> <li><a href="link6.html">LINK 6</a></li> <li><a href="link7.html">LINK 7</a></li> </ul> </li> </ul> #### Thank you, in advance! ~ lahddah I'm having a problem where IE is breaking my layout dropping my third column to the bottom, every other browser handles it fine. here's a link http://www.uww.edu/npa/crisis/intltravel/ thank you in advance. i current have the following css layout applies to a div on my webpage Code: #builds { position:relative; left:17px; padding-top: 125px; padding-bottom: 55px; } this gives me the crrect positioning in firefox and google chrome however when i try and load it in ie the positioning is totally wrong. i have tried using the Code: margin: 0px auto 0 auto; value as thi div is centerd within another however then this works in ie and not firefox or google chrome. does anyone have any ideas of anything that will work for all browsers? or even just ie, firefox and google chrome Regards, Jamie Hi I have sucessfully created a 4 column 2 row layout which works fine in IE, FireFox & Opera. The problem i have is that search1 needs to span the width of search and vote as opposed to just the width of search. (I have included the html allowing you to see what i mean). Any ideas on how i would achieve this? - its driving me insane <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <style> div.container{position:absolute;left:0px;top:283px; width:751px; background-color:#CC3300; } div.panelmain { float:left; width: 191px; background-color:#999999; } div.panelmain1 {float:left; width: 191px; background-color:#0000FF; } div.panelmain2 {float:right;width: 170px; background-color:#CCFFFF; } #featured{ width:170px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; float:left ; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #vote{ width:191.3px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; float:left; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #vote1{ width:191.3px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; clear:both; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #members{ width:191.3px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; float:left; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #members1{ width:191.3px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; clear:both; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #search{ width:191.3px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; float:left; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #search1{ width:191.3px; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-color:a6b7db; clear:both; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; } #content{ float: left; width: 55%; } </style> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <div class="container"> <div class="panelmain"> <div id="members"> members</div> <div id="members1"> <p>members1sssssssssssssssssss</p> <p>s</p> <p>ss</p> </div> </div> <div class="panelmain1"> <div id="search"> <p>Search</p> <p>d</p> <p>d</p> <p>dd</p> </div> <div id="search1"> search1 <p>s</p> <p>s</p> <p>d</p> <p>d</p> <p>ds</p> <p>s</p> <p>s</p> </div> </div> <div class="panelmain"> <div id="vote"> <p>Vote</p> <p>ss</p> <p>s</p> <p>ss</p> </div> </div> <div class="panelmain2"> <div id="featured"> <p>featured</p> <p>ss</p> <p>sss</p> <p>ss</p> <p>sss</p> <p>ss</p> <p>ss</p> <p>s</p> <p>s</p> <p>s</p> <p>s</p> <p>s</p> <p>s</p> </div> </div> </body> </html> I want to make a liquid layout with 4 boxes in this shape: [ 100% ] [50%][50%] [ 100% ] I have tried several solutions, but run into troubble with the bottom box all the time. This is what the problem looks like: http://www.student.uib.no/~st11920/...page_split.html If I comment out the bottom box the two middle boxes look fine: http://www.student.uib.no/~st11920/...outcomment.html Any help would be most welcome. Cheers Jan Terje Bakken / TankBoy Greetings, Basic Layout is: Page-Containter -> Header-Container -> Side-Container -> Content-Container -> Footer-Container Header is normal Side is a Float Left with a width of 250 Content has a left margin of 260 (to allow for the Side-Container) Footer is normal. Pretty basic. In the content area there are more divisions to handle different sections of data. The problem is that in some of the content sections, I need to have dynamically allocated "blocks" of data that form psuedo "columns". I do this by doing a float:left on each of the content blocks. (generally a 250px width) That way if I show 1 or 5, they all snug up next to each other and wrap properly in the browser. Still pretty basic. Until ... drum roll please ... the next section. Since the content is "float:left", it's removed from the layout and the following sections will just "snug up" next to the last content block. I want the section to "clear" the previous content division, but don't really have a clean way to declare the "height" of that division, due to the dynamic nature of the data. Silly Rabbit ... just do a clear:left !! In IE it works fine. In Firefox, the clear:left command is clearing the previous container! (side-container ... aka: left nav bar) First question: Which browser is right? is IE right and the clear:left should be contained to it's own division? or is firefox right and the clear:left checks all float:left regardless of division? Second question: If IE is right, what is the fix ... if Firefox is right, how should I actually structure this? Hello. I've searched far and wide for a good tutorial on how to make multi-row navigation tabs (something that kind of resembles the System Properties box in Windows). Can this be done using ordered lists? Does anyone know of a good source for this? thanks much. -Dan I saw an idea that I liked a whole lot for displaying pictures and that kind of thing. I didn't want to really hank the guys code, but tried to make my own version of it. The problem I have is yet again with Internet Explorer doing really stupid things with the pics I drop in my div's. It keeps adding a padding to it and it's beginning to aggravate me. Here is the code I had: body { height: 100%; margin: 0; padding: 0; background: #4F6A84; text-align: center; } #super_container { position: absolute; top: 70px; left: 0; width: 100%; height: 438px; background: #424242; padding: 0; margin: 0 auto; text-align: center; } #super_container { height: 438px; } #sub_container { width:775px; voice-family: "\"}\""; voice-family: inherit; width: 765px; /*border-right: 1px solid #7D1E2C; border-left: 1px solid #7D1E2C;*/ height: 438px; background: transparent; margin: 0 auto; } #sub_container { width: 765px;} #right{ float: right; width: 150px; height: 438px; background: #c5c5c5; } #left { float: left; width: 400px; height: 438px; margin: 0px; padding: 0px; background: blue; overflow:visisble; background-image:url(new_test/test1.jpg); background-repeat:no-repeat; background-position:top left; } #left img { padding: 0px; margin: 0px; border: 5px solid #fff;} #center { margin-left: 401px; margin-right:151px; padding:0px 0px 0px 0px; border-top:1px solid green; } and the html <body> <div id="super_container"><!--start of super container--> <div id="sub_container"><!--start sub_container--> <div id="right"> </div> <div id="left"> </div> <div id="center"> test </div> </div><!--end sub_container--> </div><!---end of super conatiner--> </body> the problem becomes evident when I put an image in the htnl of the left element. It either looks likeit rises just above the top of the super-container, or it is flush with the top and leaves a margin underneath it. As always, any help or design/tips as to what I am doing wrong would be great. I am just experimenting with new things, trying to see what I can or cannot do. The idea would be to have a home page with picture and right column with info. Then on the sub-pages have nav and subnav on the middle and right columns and pics on the left. Just a dry run, trying to see where i am. Thanks for the help in advance! jon I saw the use of multiple classes in one "class" attribute at a contract I was on, I wanted to know how DevShed people felt about this practice. Basic Example: css Code: Original - css Code .redFont { color: red; } .blackBack { background-color: black; } .redFont { html Code: Original - html Code <pre class="redFont blackBack">test</pre> <pre class="redFont blackBack">test</pre> Seems to work with javascript in Firefox and IE, anyway.. javascript Code: Original - javascript Code element.className = 'redFont blackBack'; element.className = 'redFont blackBack'; I have one issue left in this context menu: www.webfletch.com/sharing (( Make Sure You Right Click On The Page )) The issue is in Internet Explorer, when you click on the sub-menu or one of the links in the sub-menu. Everything works fine at that point, but when you right-click to bring up the context menu again, the sub-menu comes up showing. Because technically, the css didn't grab the mouseout (Or whatever the opposite of "hover" is.) I attempted to fix this with javascript by placing different variations of different scripts all over the code that made the sub-menu style.display = 'none' However, the javascript made the code permenant. Once it was executed, the sub-menu never showed back up again. I guess javascript out-trumps the "hover" attribute of CSS. Any thoughts? ok, ive had a look on the internet (google) and in this forum, and have been upable to come up with a decent example of a mutli tier drop down menu where the sub menu also has a menu Currently I am using this code, http://www.alistapart.com/articles/dropdowns/ PHP Code: echo " <ul id=\"nav\"> <li><a href=\"#\" class=\"bodytext\">Clients</a> <ul> <li><a href=\"http://www.commusoft.co.uk/eheating/forms/addclientcard.php\" class=\"bodytext\">New Customer</a></li> <li><a href=\"http://www.commusoft.co.uk/eheating/forms/addagents.php\" class=\"bodytext\">New Agent</a></li> <li><a href=\"http://www.commusoft.co.uk/eheating/postcodecheck.php\" class=\"bodytext\">Postcode Check</a></li> </ul> </li> </ul>"; this is the javascrip to make it work with IE Code: <script language="JavaScript"> startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace (" over", ""); } } } } } window.onload=startList; </script> Code: ul { margin: 0; padding: 0; list-style: none; width: 150px; height: 18px; border-bottom: 1px solid #ccc; } ul li { position: relative; line-height: 16px; } li ul { position: absolute; left: 149px; top: 0; display: none; float: left; } ul li a { display: block; text-decoration: none; color: #777; background: #fff; padding: 5px; border-right: 1px solid #ccc; border-bottom: 0; height: 1%; } li hover ul, li.over ul { display: block; } This is a single tier drop down menu were there are titles and a sub - menu. I was hopeing someone would point me in the direction, or show me where to begin if I want to turn this code into a multi tier drop down menu. Also, if anyone else has used this why does a gap appear between each menu option when hovering over? Any help would not only help me but will supply a decent example for others.. Thanks I have a 'DIV' tag, its css height property is set to 15px. Why is it, that it's not really 15px until I insert "font: 10px Verdana " *** one of the rules? So fi I have: #topSeperate { height: 15px; width: 100%; background-color: #00FF00; font-weight: bold; font: 10pt Verdana; } The div is perfect, but as soon as I remove the font: tag, it grows in height about 4px even though there is no text typed in the 'DIV'. If this doesnt make sense and you need further explaination, Let me know. Hi there, Does anyone know what font this is that is used for text such as "Everything you need to get a professional website online" at the top and below: "Takeaway Website Standard" When I highlight it, it has a black bacground which is unusual. Any ideas? Thanks! 1. top and bottom images are collapsing, i cant get them to display correctly without filling the html with either breaks or text 2. I cant get the images submenuedivider and submenuemarker to display simultaneously when i hover the links in the list. 3. Right now my soltuion to not display the divider image below the last element in the list is through the code: <li><a style="background-image: none;" href="x.html">SOmething</a></li> </ul> However, this also causes the mrker to not be seen above the list element as well, which isn't exactly what I wanted to happen, so what do I do? I'm stuck The CSS: Code: .leftCol { width: 190px; margin-top: 10px; margin-bottom: 10px; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 10px; float: left; } .leftCol body {font-size:100%; color: #FFF;} .leftCol h1 {font-size:1.1em; font-weight:bold; color: #FFF;} .leftCol h2 {font-size:1.0em; color: #FFF;} .leftCol h3 {font-size:1.0em; color: #FFF;} .leftCol p {font-size:0.875em color: #FFF;} .submenue { width: 188px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 0px; float: left; background-image: url(images/submenue/submenuefiller.jpg); background-repeat: repeat-y; text-indent:25px; } .submenue ul {list-style-type: none; margin: auto;} .submenue ul a {padding-bottom: 10px; background: url(images/Submenue/submenuedivider.png); background-repeat: no-repeat; background-position: bottom; display: block; line-height: 25px; text-decoration: none; font-family: "Lucida Grande", "Lucida Sans", Arial, sans-serif; color: #FFF;} .submenue ul a:hover {background-image: url(images/Submenue/submenuemarker.jpg);} .submenuetop { width: 188px; hight: 54px; padding-top: 0px; padding-bottom: 0px; background-image: url(images/Submenue/top.jpg); background-size: 100%; background-repeat: no-repeat; margin: 0; float: left; } .submenuebottom { width: 188px; hight: 60px; background-image: url(images/Submenue/bottom.jpg); background-position: left top; background-repeat: no-repeat; margin-top: 54; float: left; } The HTML: Code: <div class="leftCol"> <div class="submenuetop"></br><h1>something</h1></div> <div class="submenue"> <ul> <h3>Listing</h3> <li><a href="1.html">1</a></li> <li><a href="2.html">2</a></li> <li><a style="background-image: none;" href="3.html">5</a></li> </br> <h3>Produkt</h3> <li><a href="1.html">1</a></li> <li><a href="2.html">2</a></li> <li><a style="background-image: none;" href="3">something</a></li> </ul> </div> <div class="submenuebottom"></br></br></br></br></div> </div> Hi guys I've started this thread in this CSS forum, because I need to find a solution in CSS code. I was given the following image. I must make same menu, using CSS. But this is not a problem. My problem is to find in css a real typography that mimics following image. Does any1 know which css code and which font should I use ? The man who gave me that image doesn't know which font was used Thanks a lot in advance |