Question:
How to implement my html/css-code to a css-file?
pulsi
2009-06-20 06:42:30 UTC
Hi,

I have a little trouble. I'm trying to introduce side-notes at my web page and need a little guidance please. Based on different tutorials I've managed to crack out this code, which works fine for a web page:

---------------- CODE ------------------


Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here.


See "link" for further explanation

Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here.


Tip
  • Tip 1

  • Tip 2

Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here. Main text here.


Main text here. Main text here. Main text here. Main text here.



------------------------------

However, I'd like to implement this to my "style.css"-file so I won't have to copy this code for every page with sidenotes. I've tried to copy the css-bit into my style.css, but (off course) it doesn't work :(

This is what I've copied to my css-file:

------------- CSS -----------

div.sidenote-left { float: left; margin-left: 0px; }
div.sidenote-right { float: right; margin-right: 0px; }
div.sidenote-left, div.sidenote-right { width: 150px; text-align: left; }
div.sidenote-left div, div.sidenote-right div { margin: 0 10px; border: 1px solid #666; padding: 4px; }

-----------------------

I've tried to change "div.sidenote-right" to "div#sidenote-right" and ".sidenote-right". Also, I've tried to reorganize the code without any luck.

Does anyone know how to change the code, so that it works from my "style.css"-file?

Thanks!
Five answers:
Jeroonk
2009-06-20 06:49:09 UTC
Yes.. any style attribute or section should go into that .css file.



What you probably forgot to do, was reference it.





.

. . YOUR TITLE

. .

.

.

. . YOUR HTML

.

AvaClaire
2016-04-10 06:44:22 UTC
If all you are doing is creating static HTML pages then you don't really need a programming language like PHP. HTML can handle your needs. But if you want to do anything that requires dynamic decisions or pulls from a database then PHP, ASP.Net, etc. would be necessary. I would recommend an introductory PHP programming book. I've always found books by the publisher Wrox to be quite good.
anonymous
2009-06-20 07:34:38 UTC
Did you forget the
(and all the other divs) in all your pages?
Mike S
2009-06-20 06:46:52 UTC
Take a look here

http://htmlhelp.com/reference/css/style-html.html



Basically save the style code to sepearate file and add 'link' tag pointing to it in header section of your html file
Cami
2009-06-20 06:50:16 UTC
Is how you wrote the '---------------- CODE ------------------' example how you wrote it on the page? Otherwise it should work. If you have written your code correctly then try writing everything on a new page from scratch. Don't copy and paste.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...