A Bit About Backgrounds
In the previous HTML and CSS lenses that I have created, I had talked about backgrounds and how to add it to your lenses. I know you were probably confused and thought maybe it only works with the borders as that seems to be the only place so far that I really showed you to how to add the backgrounds. This lens is devoted to backgrounds. Now let me tell you right off the bat, some of what I am going to be showing you is easy and yet others are not. Don't worry if you don't get it all right away. It will come in time. This I hope will lead into the next html and CSS lens. I going to be covering things here that I have covered before, but I want to go into details about it more.
Basic Backgrounds
Now here I am starting with something rather basic. Now you are probably asking me how I got the box like this? Here is the code:
<p style="background: #000000; color:#ffffff; padding: 15px;">Your Text Here</p>
Where I wrote your text here, that is where you put your text in.
The background is the black you see. Where the code says Background: #000000. This is what makes the background black. Please check out my lens titled The Guide to Colors On HTML. The link is below for your convenience.
Are You Looking To Add Some Color?
Here I added all of the colors that I know work here. Just replace the code I gave you earlier with the color code you want to use. This can be used on both background color and on font color. Take out the font color that I used above as you will not be able to see it otherwise.
-
The Guide to Colors On HTML
-
My HTML and CSS lens has managed to get a bit big so I decided that I need to split it up a bit. This is what this lens is all about. What I am basically going to cover is the different colors that you can use in your own lenses. I know they all work...
Images as Backgrounds
Now lets have a bit of fun with images as backgrounds. I always like to use the colors itself for the background even though we won't be needing it. Its like a backup plan for if the image is not there. Now with this, this I am using an image as the background. I know it does not look perfect, but you get the idea. Here is the code:
<p style="border: double 5px #FFE4E1; color: #ffffff; background-color: #000000; background-image: url(ttp://images.onlinewriterscorner.com/1247195135/gallery_3_52980.png); padding: 10px">Your Text Here</p>
What the image is doing here is repeating itself. If you do not want it to repeat, then you would have to add repeat: no-repeat to the code. If you do want it to repeat and only in a certain direction, you would put in instead of no-repeat, you would choose repeat-x or repeat-y.
For the most part, I do not think you will need a fixed background but if you did, this is what you need to add:
background-attachment: fixed;
Image To The Left Or Right
This took a little working, but I did get it figured out. The original way that I was going to do this, did not work. What I tried doing was with two pieces. Actually in a round about way, this came out better as its a lot easier for you to do. Basically, what it came down to is that it did work in Mozilla, but of course it didn't work in internet explorer. I made a border as a testing ground for this lens. You are probably asking me by now is what is the code? Come on, give it to me. Stop teasing me.
Do I have to give you the code? Do I really, really want to? Yeah, I should. Okay here goes:
<p style="border: solid 1px #000000; color: #ffffff; background-color: #000000; background-image: url(http://images.sidewindhost.com/1241911261/gallery_1_15_7349.png); padding-left: 120px; padding-right: 10px; padding-top: 3px; padding-bottom: 3px">your text here</p>
You do not have to use my images, but its a start. If you can find borders, then save it to whatever you use to store images at. Then use that address and replace the address I used with the one you have. Where it says, your text here; replace it with your own. It was just a placeholder for you.
Did You Learn Anything Here?

Feel free to leave your comments here.
-
Reply
- JenniferAkers JenniferAkers Dec 11, 2009 @ 3:13 am
- I used your background code in a featured lens module, with the result being a dramatic black background, white text, and surrounding a picture. I'll be stopping by often. Thank you!
-
Reply
- Heather426 Heather426 Oct 8, 2009 @ 10:39 pm
- thank you for this! love it! 5*****
-
Reply
- Trekkiemelissa Trekkiemelissa Sep 16, 2009 @ 11:56 am | in reply to michaelgs
- Sorry, thats not available. The best we can do is what I showed you here.
-
Reply
- Trekkiemelissa Trekkiemelissa Sep 16, 2009 @ 11:56 am | in reply to michaelgs
- Sorry, thats not available. The best we can do is what I showed you here.
-
Reply
- michaelgs michaelgs Sep 16, 2009 @ 11:35 am
- But how do I change the color of the whole lens? Not just the individual text modules?
Are there templates other than those few that are available in the workshop?
Michael
- Load More
Do You Need More HTML or CSS Help?
-
HTML And CSS Mentor
-
Many of you start writing your lenses without any HTML and CSS, but as you start understanding Squidoo, you want to learn how to spice your lenses up. HTML and CSS is just the ticket that you may be looking for. Here, on this lens, you will learn fr...
