CSS - Internal Or External Css?
I was wondering what is best to use? I don't mean standard internal CSS that is hard coded but I would use PHP to build a template before it is spat out to the browser and it would make an external css file into part of the client side source code.
I think this would be more efficient for rendering purposes than linking to external CSS files in a document? Any thoughts? It would also help us in building our cacheing engine. Similar TutorialsHey, I'm a CSS noob, and I'm having some trouble with centering the content of my page. When I have the coding as an internal style sheet the page is centered, but when I put it in an external style sheet it looks the exact same...except for that it's left aligned. All I do is copy and paste it, but it change the layout around? Any tips? Is there a way to only clear floats within an element without affecting any floats defined about and outside the element? example: <div style="float:left;">A</div> <div style="float:right;"> <div style="float:left;">C</div> <div style="clear:both;"></div> </div> I would want the clear to only clear C and not A so... having this problem where i have some css styles applied to form inut boxes, and one of them asks for the user to input his/her email address. IE, thinking it's being helpful, is overriding my nice green background with an ugly yellow background. I've done some testing, and if i put the word "email", "e_mail", "e-mail", or even "mail_e" in either the html text NEXT to the blank, or in the name of the INPUT tag, IE assumes i want it to be yellow. any way of overriding this? CSS: Code: .inputBox { border: 1 solid black; background-color: #bcdd4a; font-size: 12; width: 200; height: 16; color: #145e16; font-weight: bold; } HTML: Code: <td valign=top>E-mail:</td> <td valign=top><input type="text" class="inputBox" name="emailAddress" size=20></td> IE Version: 6.0.2800.1106 LINK: http://www.t-2.biz/contact.php please help, frustration setting in. cheers \\ kfancy Im kinda new in CSS so sorry if this is a noob question Im having trouble making an external stylesheet because for some reason my html is just not loading the .css file. But I also read that an external is a little slower aswel if i'm not mistaken, because it has to read another file. But I'm in the internal stylesheet is working good but I noticed I can't create a new class using the "." before the word. Is there anyway I can create a class using the css inside the html file? Here's the template I'm working on: http://dhost.info/justusvizslas/template.php Here's my problem: I'm trying to create a centered, two-column layout with a header and a footer, sort of like the tutorial he http://nemesis1.f2o.org/aarchive?id=7 I've got everything working correctly and it looks fine in IE. However, in FireFox, the container div doesn't automatically adjust its height to be the same as the height of the divs inside. Instead, I have to set the height at a certain number of pixils to even get the container div to show up. When I do that, in IE the container div defaults to the same height as the larger of the two inner divs, but in FireFox the container div just stays at whatever pixil height I specified. That becomes problematic because I don't plan on having all my pagecontent divs with the same height. Any insight will be greatly appreciated. I've been looking at this for hours and haven't gotten it to work like it should. Here's the relevant code too: CSS Code: #container { width:792px; height:50px; margin: auto auto; color:#000000; background-color:#FFFFFF; background-image:url(design/menuimage.gif); background-repeat:repeat-y; } #navigation { width:125px; height:auto; padding:0px; float:left; margin-top:auto; vertical-align:top } #pagecontent { width:667px; height:auto; padding:0px; float:left; margin-top:auto; color:#000000; background-color:#FFFFFF; text-align:center } PHP Code: <div id="container"> <div id="navigation"><?php include "nav.php"; ?></div> <div id="pagecontent"> <br />Some more content here<br /> </div> </div> Again, thank you in advance for any help with this. If you're stumped and think it should work as-is, go ahead and go to the actual template I'm working on (first http link in this post) and look at it in IE and in FireFox to note the difference. Hi there, I'm haing a problem getting my navigation to appear correctly in Mac IE 5.2 and Safari 2.0.1. The dates on the right are supposed to pop you down to the date in the central box. It works correctly on a PC, all browsers. I replaced NAME with ID. Thanks for any help or suggestions! http://www.cofc.edu/~finchj/timeline_not_template.html http://www.cofc.edu/~finchj/style_timeline.css Jannette hi, i wanted to change a look of form submit buttons a bit and i found out i can do it using inline css, example: Code: <input type="submit" name="subbtn" value="Send" style="background-color: #fbbe2c; width: 120px; font-family: tahoma; font-size: 12px; font-weight: bold; color: #66666;"> but can't figure out how to define it using internal or external css. i tried this: Code: <head> <style type="text/css"> input.btn { background-color: #fbbe2c; width: 120px; font-family: tahoma; font-size: 12px; font-weight: bold; color: #66666; } </style> </head> ... <input type="submit" name="subbtn" value="send" class="btn"> which seems the most correct to me, but it doesn't work. style defined in this way is ignored. i'm sure there is a way to do it, but it seems i don't know the right way. could you help, please? I have a rule called #MainContent. Now I want to change this rule for just one page so I duplicate it but don't add it to the global style sheet but declare the rule for this page only. However this doesnt work the div still changes based on the #MainContent rule in the global css file First off, I am a noob, but i learn quickly... I have a cgi site (poor me) and it uses css and javascript, which i am just learning. I noticed that javascript tags refer to an exteral file, since the same fuctions are used on many different pages. The same css definitions are used over and over again also, but they are defined in each page (like 50 or 60 files). Can I create a css only file like my .js files and simply refer to it like i do with javascript? If so what does the format look like? Thanks, JOhn hi, it seems like my external css is not working... Code: <link href="print.css" rel="stylesheet" type="text/css"> if i convert it to a internal one, it working fine.... i'm using a ie browser .... so if you know what is the problem or how to slove this problem, please reply me... Thanks alot.... In my project I have my project folder, in which there are 3 subfolders: CSS, JS & PHP. In my php web files I have a header link to an external CSS file (in the CSS folder) controlling certain styles in each PHP files. Code: <link rel="stylesheet" type="text/css" href="./CSS/Home.css" /> Yet, the CSS is not having any affect in my php file(s). Can any hazard a guess as to what could be causing this? Appreciate any ideas? It could be something obvious. but I'm not seeing it. Is it possiable for me to add an external font family on a certain text? I mean.. Is it possible for me to use ttf fonts on css to modify my html page? P.S: I hope It makes sense.. because I'm tired I have this tag in an external css file Code: td { text-align:left; //and yes i know that its left by default } Inside my html file I have a td with alignment set to right, which according to my understanding should override the external css file, however it doesn't. The content is still left aligned. Why is that? Thanks I have been going through the tutorials and forums learning CSS. Everything works and makes sense until I get to the lesson for setting up a div box. For some reason I am missing something here. None of the lessons or forums even address or talk about how to connect or input the external div CSS into the web page. They only show the external CSS code or internal CSS code. They never show what is required in the HTML to pull in the external div CSS. Even when I copy and paste the code from the different lessons I can not get a div box unless I put it in-line in the HTML code with a <style> tag, which defeats the concept of using an external CSS for the div box. How do I link an external CSS div.box to the default.htm web page? What coding is required in the external CSS and in the default.htm HTML to have the div.box brought into the web page? Does the div.box code have to have its own .css file to work? How do I get the external CSS code for the div input to the HTML? Thanks Hello I'm having trouble with displaying a background image in a div. It worked fine with embedded CSS but when I changed the CSS to external, the text loads but the bg image doesnt. I'll post some code to explain it... This is in the external style sheet: #navbgtop { position:absolute; left:38px; top:185px; width:194px; height:18px; z-index:2; background-image: url(images/navbartop.jpg); } and yes of course I have made the proper link to it in the <head> tag: <link rel="stylesheet" type="text/css" href="css/nav.css" media="all" /> For some reason the background image wont display. Any ideas? One more question also, does it matter if I use media="all" for the whole website? Or do I even need to bother using media=xyz ? I heard most browsers don't even read that as of yet. Hi. I've places where a div have style="display: block; float left;" and it's only on 1 or few pages. As I go on it still I'm doing this frequently but if I added to the external style it will grow as well but the reason why I do it inline because there isn't much style for a set of div. Also when you specify a external style then is that means it will load once and stay in cache when it loads a page that re-use the external? I'm not expert in CSS and want to know what's the best approach. Thanks. Ok, I just started a new website. I have been putting all of the html on every page. So, when I change one small thing on my Nav Bar, I have to go to every single page and change it! There has to be an easier way, right? Isn't it by using external sytle sheets? I tried this code in my homepage, but it isn't working: Code: <head> <STYLE TYPE="text/css" MEDIA="screen, projection"> <!-- @import url(http://www.freewebs.com/ohhdanggggraphics/BASIC.css); --> </STYLE> </head> Basically on my site the only thing I want to change from page to page is the information in the center table. How would I do this? Thanks for your help My Website one of my client's pages is not rendering my external css in mozilla firefox. the page's index is: (URL address blocked: See forum rules) It is in a frameset... the simplest page on my site is (URL address blocked: See forum rules)/leftspacer.html. I cannot get the stylesheet to put the background image in proper alignment. PLEASE HELP! I'm using external style sheets on a couple of sites, and have the following problem: When I click and drag down over the text, to copy & paste it into an email or whatever, all the text on that page is automatically highlighted .... I can't control the drag / selection, it's all or nothing. When I click and drag upwards, nothing happens at all ... it won't work. Any way to solve this? I don't get this problem with internal style sheets. Andy Hello. I appreciate your help very much, (the subject might or might not be directly replated to python) Binding external css (the basic CSS1 standard) file to an html doesn't work. [ It does work if the styles definitions are embedded in the page itself ] I'm using apache on linux and I tried 2 browsers ( mozilla 1.5-3(debian) and konqueror 3.1.5 ) I'm using the very simple example which doesn't work #!/usr/bin/python print 'Content-Type: text/html\n\n' print '''<html> <head> <link href="jazzy.css" rel="stylesheet" type="text/css" /> </head> <body> <h1> hello </h1> </body> </html> ''' and the css file ( jazzy.css) looks like h1 {color: yellow; background: yellow; } p {margin-left: 20px} body {background: red; color:red } Both files are in the same virtual directory and both have full permissions(rw) for everyone. I Idon't have an idea what the problem is. Thanks a lot Roy |