CSS - External 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 Similar TutorialsHi there and thanks for reading & helping! I am new to this site, but here is my question: I need to build about a 20 page website. I have been told I should do the "layout" for each page using CSS. Is it possible for each page to "link" to one CSS file for layout instructions? I have found suitable CSS layout templates but am unsure how to link each page to the external CSS file for a basic "header, 2 column, footer" layout, or if it is even possible? 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.... 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. 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 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. 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! 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. Can you cache external css files (to make pages that use the same css file load faster)? If so, how? BTW, here is how I currently load my css (from zen garden): Code: <STYLE type=text/css media=all>@import url(/main.css); 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 Hi, I'm new to style sheets and hope someone can help me with this question. I can't figure out how to use special characters in a page which refers to an external style sheet. I specifically need to put in an accented "e", and it worked fine in another place which is just an internal sheet, but in the externally referred one it comes out as a gibberbox, looking like a chinese character. I can only assume it has something to do with the difference between the types of css, which is why I bother to make reference to them, but I can't figure out how to get that e to show up right. Help much appreciated.. Maria 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 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(I realy don't know what's it related to)) 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 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 I wrote a simple page using an external style sheet. It works fine on my home computer on both IE and NS but when I look at it from the server NS ignores the external link. Can someone please tell me what is going on. I used an embeded syle and that seemed to work but I would like it to work externally. JG I'm using an external style sheet with: p{ text-align: justify; } Within myfile.html I have: <p align="center">My paragraph</p> <p align="left">My paragraph</p> <p align="right">My paragraph</p> I assumed that the html inline would take precedence over the external css but it is not; all of my <p> text is justified! Why? I'm a nube with css and I'm testing. I'm not planning on using the html align, but, if necessary I'd like to know why it is not working as I thought. If I remove the style sheet reference then the <p> statements do work. Help. Hi, I have a XHTML 4.0 file and CSS in a separate file. The CSS if included within the <head> section of the HTML file works correctly and displays the page with the right formatting. However, when I move the CSS to a separate file and just use the <link> tag within the <head> section of the HTML file to link to this CSS file, the formatting is not applied. I am not sure what to do. Any quick help is greatly appreciated. Thanks xworder |