CSS - Dynamically Setting Styles Using Php
Code:
<?php if currentpage != account.php { $_SESSION['links'] = "display:none;";s } ?> then on the external css file i have: #accountLinks { <?php echo $_SESSION['links']; ?> } ?> \accountLinks id is joined with the submenu. the problem is when i view the main.css from the browser it doesnt display the value of session['link'] but that line... Similar Tutorialshey i'm trying to get the arrow on the select field to be colored as well as the scroll bar when the options drop down. any help? Is it possible to set link styles that are defined inside of a heading tag... for example, h1 a:link{bleh} h1 a:visited{bleh} h1 a:hover{bleh} I tried it... but it doesn't want to go, I'm thinking I might have to think of another solution Greetings, friends! I have a quick question about CSS. I am fairly versed in CSS 2.0 and the selectors that are used within. However, I am not sure if any specific type of selector is available to help me do what I want. I am looking for a selector that will define styles for an element that contains specific children. To give you an example, let's say that I have an image on my page. That image is assigned the class of "alignleft". Now, let's say that I make that image into a link. I would like to find a CSS selector that allows me to assign style definitions to that link. Let's say my code looks like: Code: <a href="http://www.example.com/"><img src="example-pic.png" class="alignleft" alt="Example Picture" /></a> Now, I know if it was the other way around: Code: <a class="alignleft" href="http://www.example.com/"><img src="example-pic.png" alt="Example Picture" /></a> I could use something like: Code: .alignleft > img However, I am not sure if there is any way to go up a level in CSS. I would envision it looking something like: Code: a < img.alignleft but I can't find anything in the CSS spec that refers to instances like that. Does anyone know of anything? For instance, I would want a spec that looks something like: Quote: E < F - Matches any E element that is the parent of an element F. The specific reason I'm looking for something like this is that I am using the class of "external" to assign a background image to all of my links that lead away from our Web site. However, if that link is an image rather than text, I want to set the background of my link to "none" so that the background image does not interfere with the image itself. Any help would be greatly appreciated. Thank you. Unfortunately I am not very experienced and I am trying to edit some coding that has been done for me. The code is as follows <div title="[[TITLE]]" style='background-image: url ([bg]); padding: 5%; width:90%; height:100%; padding-left: 6%; padding-right: 6%; background-size: 100% 100%; '> Now what happens is the words I type in this box are beautifully laid out because of the padding... The images placed in the box should stretch border to border - but obviously don't because of the padding.... Can anyone please tell me what I can change to give my text padding but images with no padding? Thanks so much I'd like to seperate blocks of text with a horazontal rule. I'd like it to be dashed. So, I've come up with this: Quote: hr { border: none 0; border-top: 1px dashed #000; width:98%; height: 1px } However, although this works well in IE, it Firefox there is too much space between the HR and the text block under it. In other words, the text above the HR comes right up to the line, but the text under the line, there is a larger gap. Any way to close the gap? Any ideas? Hello -- new to this forum. My questions concerns a problem I've run into many times. I'm trying to be CSS-moral and use style sheets as much as possible, or a least place properties in the Header. But here's what I run into. Many times I find it necessary to have different properties for the same tag within the Body. Currently, I use CSS to create the Menu items at the top of each web page, an Unordered List, using the "li" tags. Ok, but I just discovered that by using a new CSS statement, I can use custom bullets in the Body's li tag: list-style-image : url(bullet.gif) . Cool!!! So, I went about making a little dog bone .gif and used it for my bullet graphic halfway down the page. Voila! It worked. Voila! I suddenly have dog bones in my menu (which I don't want !), which also use the li tag. I only know two workarounds. 1) is to go back to the BAD practice of using the taboo in-line style="images/dogbone.gif" in each li within the body and NOT put the statement in the Header style section or 2) at least try to use CSS in the header by making a class like li.bone { list-style-image : bone} and then repeat class="bone" for each li in the body, which is only slightly shorter than just putting in the style="xxx" in the first place. So, how do we handle using different style properties for the same tag within the body? Perplexed, Mike I have a page that I'm building as a prototype for a working medical exam GUI. I'm using Dreamweaver and it's pretty ugly. Is there anywhere I can download some styles that will bring this site to life? Maybe OSX or Vista-looking stuff? i imagine this has to be one of the easiest questions, yet i have looked at tons of css table pages and cant find the answer. All im trying to do is create different styles for my tables on my website for example: Code: <table class="table1"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> <table class="table2"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> table 1 would have the following: black background white text underline text table2 would have the following: green background black text larger fonts the above colors are just an example, but my question is how would i do my CSS to support this if i wanted it to look this way? Thanks for any help. I understand how to write a print.css style sheet, but I am unclear on how to use it. I want to have a link on my page that says "Printer Friendly Version" that displays the printer friendly version and lets them hit the print button on the browser to print it. I think this is the most common way to print a web page, right? So I am displaying to the screen first and the printer if they hit the button. So how do I get the print.css formatting to display instead of the screen version? Obviously I want a single markup file for both purposes. Hi, I have an issue where my css loads fine with Safari and Firefox. However, I have no styling when it comes to any versions of IE. I have listed the code below. Any help would be greatly appreciated. (There is a bit of php, but css is not loaded through it). Code: <?php require_once("php/includes/sitewide.php"); ?> <!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=utf-8" /> <title></title> <?php keywords(); ?> <?php description(); ?> <link href="css/sitestyle.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="menu"> <ul> <li class="active"><a href="<?php echo $link1; ?>"><?php echo $namelink1; ?></a></li> <li><a href="<?php echo $link2; ?>"><?php echo $namelink2; ?></a></li> <li><a href="<?php echo $link3; ?>"><?php echo $namelink3; ?></a></li> <li><a href="<?php echo $link4; ?>"><?php echo $namelink4; ?></a></li> <li><a href="<?php echo $link5; ?>"><?php echo $namelink5; ?></a></li> <li><a href="<?php echo $link6; ?>"><?php echo $namelink6; ?></a></li> <li><a href="<?php echo $link7; ?>"><?php echo $namelink7; ?></a></li> </ul> </div> <!-- end #menu --> <div id="header"> <h1><a href="<?php echo $link1; ?>"><?php echo $site_title; ?></a></h1> <h2 style="color: #FFFFFF;"><?php echo $statement; ?></h2> </div> <!-- end #header --> <div id="page"> <div id="content"> <div class="post hr"> <h1>Welcome to <em>Site Title</em></h1> <img src="images/building_1.jpg" alt="" width="120" height="120" class="left" /> <p><strong>SiteTitle</strong>performs home inspections that exceed the standards of the American Society of Home Inspectors. After accompanying us during the inspection, reading the inspection report, the client will know more about the home they are planning to purchase and quite often will know more about the condition of the house than the seller!*</p> </div> <div class="post"> <h2>Home Inspections</h2> <p><strong>Home Inspections</strong> are a necessity for homebuyers in South Carolina when purchasing a new or existing Home.*Potential homebuyers MUST be knowledgeable and informed of any and all problems that may exist prior to closing. The challenge is to find a qualified home inspector with the experience and knowledge of performing a thorough and comprehensive inspection of the property that the buyer can trust and can rely on the accuracy of the inspection.</p> <h3>Join Us</h3> <p>Join the hundreds of satisfied clients who have retained us to help them with their real estate transactions.</p> <blockquote> <p><?php quotes(); ?> </p> </blockquote> </div> </div> <!-- end #content --> <div id="sidebar"> <div id="updates" class="orangebox"> <h2><?php echo $header1; ?></h2> <ul> <li><a href="<?php echo $inspectlink_1; ?>"><?php echo $inspectname_1; ?></a></li> <li><a href="<?php echo $inspectlink_2; ?>"><?php echo $inspectname_2; ?></a></li> <li><a href="<?php echo $inspectlink_3; ?>"><?php echo $inspectname_3; ?></a></li> <li><a href="<?php echo $inspectlink_4; ?>"><?php echo $inspectname_4; ?></a></li> <li><a href="<?php echo $inspectlink_5; ?>"><?php echo $inspectname_5; ?></a></li> <li><a href="<?php echo $inspectlink_6; ?>"><?php echo $inspectname_6; ?></a></li> <li><a href="<?php echo $inspectlink_7; ?>"><?php echo $inspectname_7; ?></a></li> </ul> <h2><?php echo $header2 ?></h2> <ul> <li><a href="<?php echo $categorylink_1; ?>"><?php echo $categoryname_1; ?></a></li> <li><a href="<?php echo $categorylink_2; ?>"><?php echo $categoryname_2; ?></a></li> <li><a href="<?php echo $categorylink_3; ?>"><?php echo $categoryname_3; ?></a></li> <li><a href="<?php echo $categorylink_4; ?>"><?php echo $categoryname_4; ?></a></li> <li><a href="<?php echo $categorylink_5; ?>"><?php echo $categoryname_5; ?></a></li> <li><a href="<?php echo $categorylink_6; ?>"><?php echo $categoryname_6; ?></a></li> <li><a href="<?php echo $categorylink_7; ?>"><?php echo $categoryname_7; ?></a></li> </ul> </div> </div> <!-- end #sidebar --> <div style="clear: both;"> </div> </div> <!-- end #page --> <div id="footer"> <p id="legal"><?php echo COPYRIGHT; ?></p> </div> <!-- end #footer --> <?php analytics(); ?> </body> </html> Here is the css. Code: @charset "utf-8"; * { margin: 0; padding: 0; } body { background: #FFFFFF url(../images/img01.gif) repeat-x; text-align: justify; font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; color: #666666; } h1, h2, h3 { color: #333333; } h1, h2 { margin-bottom: 20px; font-weight: normal; } h1 { font-size: 197%; } h2 { font-size: 152%; } h3 { font-size: 100%; } p, ul, ol { margin-bottom: 20px; line-height: 1.8em; } ul, ol { margin-left: 3em; } blockquote { padding-left: 3em; background: url(../images/img08.gif) no-repeat; font-style: italic; } a:link { color: #1953A7; } a:active { color: #ED5C0C; } a:visited { color: #666666; } a:hover { text-decoration: none; color: #067600; } img { border: none; } img.left { float: left; margin: 0 20px 10px 0; } /* Menu */ #menu { width: 770px; height: 65px; margin: 0 auto; border-right: 1px solid #EDEBD5; } #menu ul { margin: 0; padding: 0; list-style: none; } #menu li { display: inline; } #menu a { display: block; float: left; width: 109px; height: 45px; padding: 20px 0 0 0; border-left: 1px solid #EDEBD5; text-transform: lowercase; text-decoration: none; text-align: center; font-size: 144%; color: #BABABA; } #menu a:hover { background: #F7F7F4; } #menu .active a { background: #F49A24; color: #FFFFFF; } /* Header */ #header { width: 770px; height: 170px; margin: 0 auto; } #header h1 { float: left; width: 220px; height: 100px; margin: 0; padding: 70px 0 0 0; background: url(../images/header_left.jpg) no-repeat; text-align: center; font-size: 36px; } #header h2 { float: right; width: 530px; height: 86px; margin: 0; background: url(../images/header_right.jpg) no-repeat; padding: 84px 20px 0 0; text-align: right; } #header a { text-transform: lowercase; text-decoration: none; font-style: italic; font-weight: normal; color: #FFFFFF; } /* Page */ #page { width: 770px; margin: 0 auto; padding: 20px 0; } /* Content */ #content { float: left; width: 550px; padding-top: 10px; } #submitButton:hover { } .submitButton { border-width: 1px; padding: 5px; border-style: solid; margin: 5px; border-color: #000000; color: inherit; } .input { border-width: 1px; padding: 5px; border-style: solid; margin: 5px; border-color: #000000; color: inherit; } .inputSmaller { border-width: 1px; padding: 5px; border-style: solid; margin: 5px; border-color: #000000; color: inherit; } .post { margin-bottom: 20px; padding: 0 20px; } .hr { border-bottom: 1px solid #EDEBD5; } /* Sidebar */ #sidebar { float: right; width: 210px; padding: 5px; background: #EDEBD5; } #sidebar h2 { margin: 0; padding: 5px 15px; color: #FFFFFF; } #sidebar h3 { font-size: 85%; color: #FFFFFF; } #sidebar ul { margin: 0; padding: 15px; list-style: none; } #sidebar li { } #sidebar a { color: #FFFFFF; } .orangebox { background: url(../images/img05.gif) repeat-y; } .orangebox h2 { background: url(../images/img06.gif) repeat-y; } /* Footer */ #footer { clear: both; height: 100px; padding: 25px 0; background: #EDEBD5 url(../images/img04.gif) repeat-x; } #footer p { margin: 0; text-align: center; font-size: 77%; } #footer a { color: #666666; } I have a header.inc and a css style sheet that are called to each page of a website via php. In the style sheet there are two styles that I would like to change depending on the section of the website. For example: in the style sheet css id "subnav" has background: #E8EDF5 and cssi id "subtitle" has background #E8EDF5 however in each major section of the website I would like to change the background colors of the divs that have id "subnav" and "subtitle". Is there type of php statement that I could place at the top of my website pages that would allow me to specify the colors of these two css ids? Hope I have made this clear. Hi, I remember reading that there is a css attribute for removing all browser-specific formatting from an element, for example forms, H tags and divs (which are pre-formatted differently in ie and firefox) but I can't recall what it was! Does anyone know how this is achieved as I find it very laborious when creating stylesheets to have to remember to reset all of these elements' formats. - before anyone says it, I know I could set up a generic, cross-browser-ready stylesheet for use with all my sites, and this is a system I already employ, I am simply concerned with saving bytesize and achieveing smaller stylesheets that are more easy to work with. I remember it was something like this: instead of: form{ margin:0px; padding:0px; } I'm sure you can do something like: form{ preformatting:none; } Does anyone know what I'm talking about? Or did I dream it?... cheers in advance Hi, I'm trying to create a PDF of my site, and I want it to look EXACTLY like the site. Right now the links are coming out blue (instead of the color I've defined in my CSS), and the fonts are not displaying according to what I've defined in the CSS. Someone once told me that I can overlay the pages with a transparent gif and that would preserve my original CSS definitions. But I can't get that to work. If I add a <div> to the html page, in an effort to overlay a transparent image over the entire page, and then I convert it to a PDF, then in the PDF the big transparent image just moves to the bottom, underneath the rest of the page. Thanks to anyone who can maybe help. Laura S. I am looking for a way to implement CSS styles on DropDownList ListItems. In HTML it's pretty easy: PHP Code: <select> <option class="red" value= "Yes">Option 1</option> <option class="pink" value= "No">Option 2</option> </select> But in ASP.NET-VB I'm hitting a snag. PHP Code: <asp:dropdownlist id="ddlList" runat="server" Width="180px"> <asp:ListItem Value="Yes" class="red">Option1</asp:ListItem> <asp:ListItem Value="No" class="pink">Option2</asp:ListItem></asp:dropdownlist> That code doesn't work. When compiled, it totally deletes the "class" attribute. Any thoughts? What is the difference between inline styles and id's? Are there places where you should use one and not the other? Sorry if this has already been answered but I couldn't find anything in a search. I need a way to apply a different style to IE6 and IE7/Firefox. The webpage renders as expected in IE7/Firefox but IE6 needs to be fixed. Here is a mockup of what I need to have: Code: .featdesc { margin-left: 10px; margin-top: 10px; width: 400px; text-align: justify; if (ie6) font-size: 11pt; else font-size: 10pt; color: #505050; } Is there a way to accomplish this? I am hacking a clients css. Can someone tell me where I am going wrong. His site is a Smarty one. Here is the meta tags. The website is www.russiansweets.us and I am trying to format the links in the right nav menu underneath the search function that are presently red. I added class A.one:{} Class but it seems not to make a difference. I get the same color links before as after (red) Code: <html> <head> link href="stylenew.css" rel="stylesheet" type="text/css"> {literal} <style> A { COLOR: red; FONT-FAMILY: Arial, Verdana, Helvetica; FONT-SIZE: 11px; FONT-WEIGHT: bold; TEXT-DECORATION: none } A:hover { COLOR: #993300; FONT-SIZE: 11px; FONT-WEIGHT: bold; TEXT-DECORATION: none } // here is the part I added a.one { COLOR: #FFFFFF; FONT-FAMILY: Arial, Verdana, Helvetica; FONT-SIZE: 13px; FONT-WEIGHT: bold; TEXT-DECORATION: none } a.one:hoover { COLOR: #FFFFFF; FONT-FAMILY: Arial, Verdana, Helvetica; FONT-SIZE: 13px; FONT-WEIGHT: bold; TEXT-DECORATION: none } </style> //end of what I added {/literal} Here is the html Code: <td> <a class="one" href="disclaimer.php">Disclaimer</a> </td> I've read up, and have always used a bit of CSS. I'm redoing my site, and noticed something different between Mozilla and IE. Personally, I'd ditch IE, but 98% of my viewers use it, so I can't. Basically, in IE, the following works: Code: P { color: black; font-size: 10pt; font-family:tahoma; } myown { color: blue; font-size: 10pt; font-family: Tahoma; } <myown>This is my text</myown> When I run it in IE though, it basically ignores the self-defined tag, and requires me to use a pre-defined keyword. I don't want to use "P", b/c it carries the html<P> tag characteristics... a new line in this case. Thanks. Newbie question...I've always struggled with getting my links to show up right (hover styles, visited styles, etc.) In this case, I want my links to show up without an underline normally, but with an underline when hovered over. When they're visited, I don't want there to be any difference. I want them to show up normally. Right now I've got Code: .leftnavtext A:link { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #666666; text-decoration: none; } .leftnavtext A:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #666666; text-decoration: underline; } .leftnavtext A:visited { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #666666; text-decoration: none; } .leftnavtext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #666666; } And when I hover over a visited link, it doesn't get underlined. Any idea why? Thanks. This is the website I am working on: http://www.rookscommunications.com/projects/naturalne/index.html Everything is working fine, except the footer. When I view it in FireFox, I'm all set, but most likely most people will be using IE and that's where the problem is. Any thoughts on the bug? I've tied many different things. ALSO... to kill two birds with one stone. Could you peek at my javascript for random images...every now and then it selects a blank image and that's no good. Many Thanks |