CSS - Style Versus File
Why will
Code:
#navcontainer ul { margin: 0; padding: 0; list-style-type: none; text-align: center; } #navcontainer ul li { display: inline; } #navcontainer ul li a { text-decoration: none; padding: .2em 1em; color: #fff; background-color: #036; } #navcontainer ul li a:hover { color: #fff; background-color: #369; } work in the document inside style tags but won't work if set into a separate css file? Thanks. HeadElf Similar TutorialsHi, I'm wondering if it is possible to override style settings in an external html document. I'm using the <--#include file command to include a html file. I don't want to modify the html file, because people (here at work) are making documents in word9 and save it to html. The major problem is that the <hr> line is too long and so is the text, so it don't fit on our website, at this point these documents are opened in a new window, but it would be nicer to intergrate them into our site. thanks -Dan In my main CSS file, the background-color is set to #FFFFFF (white) however this also erased my background images in the cells of my table i have tried to add them with style tags, but the main CSS still overrides Top of the table + cell with bg PHP Code: <table cellpadding="0" cellspacing="0" border="0" align="center"> <tr> <td width="766" height="295" valign="top" style="background-image:url(images/row1.gif); background-repeat:no-repeat "> This is the main CSS: PHP Code: body,td,th { font-family: Tahoma; font-size: 11px; color:#5D5D5D; background-color:#FFFFFF; } body { font-family: Tahoma; font-size: 11px; color:#5D5D5D; background-color:#FFFFFF; } Hi, I was wondering if anyone could explain why I should use the id attribute of div. The id attribute is only usable once on a page. This seems to me to be slightly innefficient when I could use a class attribute and reuse the style on the page. Also, specifying an id as follows:- div#maincontainer span.innerblock { ......... } Once again, by doing this I have not only confined the innerblock stye within the maincontainer id, but also to the span tag. Again, this stops me re-using the style elsewhere. By using these methods (perhaps inappropriately), I am ending up with bloated css. I'm sure I'm missing something here . I would be really grateful if someone could explain the logic behind these two methods. Many thanks in anticipation. I'm working on generating a TOC with PHP pulling info from my DB. What I want to figure out is if there is a way to do columns with CSS without using a table? I read about the <multicol> tag that isn't supported ... it would have been perfect for my needs. The reason I was looking for something other than a table, is because I have a list of dates that look like this: 1859 2000 1959 2001 1999 2003 If I use the PHP script then it looks like this: 1998 1999 2000 2001 2002 2003 I don't want the change to cause too much confusion amongst our inexperienced users. Any suggestions other than tables? I am just wondering if there is a way to simply extend a style rule from one previously defined. For instance, if I have this rule: Code: .textarea-box { color: #990000; background-color: #fff; width: 375px; height: 200px; border: #000 solid 1px; } ...if I want another text area rule to be the same except for one difference, the height should be 80px, do I have to write the rule out again with a new name, incorporating the new height, or is there some nifty way to just change the height in the new rule? Thanks for help with this. j9 I have a menu bar made up of <a href> elements that have a hover style of:
PHP Code: #mainMenu a:hover { color:#000000; background-color: #66c74c; padding: 1px 4px 1px 4px; margin: 1px 1px 1px 1px; } This will provide a green colored rollover visual as the user moves their mouse over the menu bar. I just added some JS today that will highlight the clicked (selected) menu so there is visual feedback of the section the user is in. For some reason, after setting the background color of the <a href> and color attributes, the HOVER: no longer functions. Here is the code to do the hilite where I pass the ID of the <a href> menu selection in the variable "menu": PHP Code: //--- Simplify setup by creating an array of the menus and hilight ID's --- var menus = ["menu1","menu2","menu3","menu4","menu5", "menu6","menu7","menu8","menu9","menu10"]; function J_hiliteMenu(menu) { //--- first make sure all the menu are hidden and unhilited --- for(i=0; i < menus.length; i++) { if (menus[i] == menu) theIndex = i; // Hold on to the chosen index position var obj = document.getElementById(menus[i]); if (obj == null) continue; // if menu is not available skip it obj.style.color = "#ffffff"; obj.style.backgroundColor = "#234fd7"; } //--- hilite the menu we're interested in --- var obj = document.getElementById(menu); obj.style.color = "#000000"; obj.style.backgroundColor = "#f8f400"; } Prior to hiliting the menu I un-hilite all the menus (since we may be switching from another). I think this is where the problem is. Maybe I need to redefine the rollover "hover" attribute for all elements during the un-hilite loop? Does anyone know how to set a HOVER: attribute using JavaScript? Thanks! I was reading a tutorial were they always style both <tr> & <td> with the same thing... Is this needed? Or do you just need to style <tr>? Code: table.navigation tbody tr.odd { background: #252525; color: #fff; } table.navigation tbody tr.odd td { background: #252525; color: #fff; } Hello, In the css below, why I can't set it on the same time? Code: background: #FFF url(../images/main_bottom.gif) no-repeat bottom ; background: #FFF url(../images/main_top.gif) no-repeat top ; I did a web page for a company and it looks fine in ie7 where I tested it. The problem is when viewed in IE6 its like it ignores the sizes I put in. The box appears too big in IE6 and is the propr size in IE7. Is there any way to fix it so it would look the same in IE6 as IE7? How would you go about creating a navbar like the one Red cross uses on the left side for generic website mapping? Red Cross Example Is this pure css with dual images? Or is this done with some effect with other forms of CSS (or even DHTML?) on my site I have a list with the UL Class of threads. I am not good with CSS at all I have this Code: #threads { padding:0; margin:0; } #threads li { list-style:none; border-bottom:1px dotted #ccc; display:block; padding:2px 0px 2px 13px; background:url(images/sub.png) no-repeat 0 0px; } not doing what I want, my site is mypricesavings(dot)com you can see the list on the homepage under Recent Activity, I'd like to make it so that the avatars line up on top of each other and a line between each one like the featured section located on this site, however, without the scrolling. http://demo.colorlabsproject.com/?theme=arthemia-premium thank you for attempting Again I have arrived with yet another inquiry regarding tableless layouts. I have been tasked with the creation of a fairly complex calendar application. Creating this using tables would be no problem for me, but I am wondering if this is what I should be doing. I remember hearing that you should only display "tabular data" using tables, which would imply that I should be using divs and the like to create this app, not tables. Does anyone have any resources that specifically tackle the task of creating a calendar using CSS techniques? I feel that I could do it, but I just need a basic approach to get me started. The biggest issue I am having is regarding the days dropping down to a new "row" after seven boxes have been displayed. I can provide no code, obviously, since I haven't started yet. I'm just merely looking for some insight. Thanks in advance! Or can it be within the body tag? What is the standard? TIA Is there a way to use CSS to apply "no" style to something? I know it's strange... I'll explain. I have a general style for all the forms on my website but there is one form I want to appear as the standard default looking form. I don't want to assign an id or anything to the styled forms because then I would have to go back and edit every single page... I'd much rather do something to the 1 form to make it look like the browser default. Is there a way to exclude something from taking on a general style? Any help is appreciated! Thanks! Hi people, What is the equivalent of this div style attribute in css? <div style="overflow: hidden; position: absolute; left: 0px; top: 0px; width: 500px; height: 300px"> Its the overflow what I'm looking for. -just edited this that I have the solution sorry beginners corner I have links at the bottom of my site, similar to the links at the bottom-right corner of this forum. The links are white, except when hovered over they turn grey. Now my problem is that each time you look at a page, at least one of these links will not show the grey hover effect, they'll just stay white. I've tried this in Firefox and IE 6 with the same results. It can't be my coding because the links do this at random. Anyone ever come across this? *Here's the HTML and CSS code <td height="27" valign="top" background="images/bottom.gif" style="background-repeat:repeat-x"><div align="center" style="padding-top:11px" class="links"> <a href="/">Home</a> | <a href="company.php">Company</a> | <a href="order.php">Order</a> | <a href="support.php">Support</a> | <a href="clients.php">Clients</a> | <a href="legal.php">Legal</a> | <a href="privacy.php">Privacy</a> | <a href="sitemap.php">Sitemap</a></div></td> .links a:link { color:#FFFFFF; text-decoration:none; } .links a:hover { color:#CCCCCC; text-decoration:none; } .links a:visited { color:#FFFFFF; text-decoration:none; } .links a:active { color:#FFFFFF; text-decoration:none; } hello there. I place a class="titlebg2" on tables on my site in order to give them the nice background image, font, etc ... yet, on a specific table, I would like to overcome the font-size. how could this be done ?? I tried placing the following before the table in question, Code: <div style="font-family: Times; font-size: 12px"> but this did not work. any help ?? Layout: http://65.26.50.204/ec/index.php CSS: http://65.26.50.204/ec/stylesheet3.css What It Should Look Like: http://65.26.50.204/elementalconceptslayout9.jpg My last thread wasnt going to get a response it was too messy. Im having problems, I completely coded the layout to the best of my ability, I read up, searched on google for help, and this is what I came up with, I dont see why it wont work perfectly and flawlessly. Problems in Firefox - Please help any if you can, im begging. 1) The Spacer Line is supposed to be about 15px lower, right below the roundness in the navigation. 2) The navigations header and footer images have about a 6px margin below them, causing the text to be positioned low, and the background to expand longer, making it look like crap. 3) Theres a space between the body and footer div's. Things I Just Cant Get It To Do - Please help any, I'm getting so pissed off, I'm about 2 seconds from going back to tables permanently! 1) The background to expand 100%. 2) No font-color attribute valid anywhere? Its invalid in the code, and invalid in the css... so how do I change the font color... thats F'd up! Problems in IE - Not as important, I will fix later. 1) Almost all Firefox Errors 2) The spacer bar and navigation bar are about 20px apart. --- Please no posts to articles or anything, I have read everything, ive looked at sites source to see how they did it, and ive read tutorials on how to code layouts using divs [thats how I figured out the floating menu]. --- Thank you, it would be greatly greatly greatly appreciated if you can even help 1 thing. |