PDA

View Full Version : Background on Div but on HTML side & and Links


Death Dream
09-15-2008, 08:01 PM
I have a div class that I will have repeated over six times but only need the background image to change in these. I'd rather not have to make more code if I do not need to so I was wondering if something like this would work:


<div class="block" background:#FFFFFF;></div>Also, how can you make a div linkable? Like if you click anywhere in the box that that div container is holding (even blank space) you get linked.

~Death Dream~

domedia
09-15-2008, 08:58 PM
1. How about this:
<div class="block" id="block1"></div>
<div class="block" id="block2"></div>
<div class="block" id="block3"></div>
<div class="block" id="block4"></div>
<div class="block" id="block5"></div>
<div class="block" id="block6"></div>

Now you can set the common CSS styling in .block, and the specific ones in #block1 etc.

To make the box clickable maybe call a javascript function through onClick on the element.

Death Dream
09-15-2008, 09:59 PM
Hmm wasn't aware of being able to make an ID and a Class inside one div. That did what I wanted it to do. Will post a pic of it later in the WIP post.

I'll work on the onClick thing next.

~Death Dream~

Corrosive
09-15-2008, 10:07 PM
Hmm wasn't aware of being able to make an ID and a Class inside one div. That did what I wanted it to do. Will post a pic of it later in the WIP post.

I'll work on the onClick thing next.

~Death Dream~

He, he. Domedia showed me the light the other day with the id & class thing. Very useful.

domedia
09-15-2008, 10:11 PM
Not sure why you guys would think that one HTML attribute would exclude another one in the first place.. :-/

Death Dream
09-15-2008, 10:16 PM
Not sure why you guys would think that one HTML attribute would exclude another one in the first place.. :-/

Class and ID were one in the same how I saw it. Cut me some slack lol. I was a table whore before this! XD

~Death Dream~

domedia
09-16-2008, 03:03 AM
Class and ID were one in the same how I saw it. Cut me some slack lol. I was a table whore before this! XD I know, I know :) ..and we haven't even touched semantics, microformats, js frameworks, flash replacement techniques etc etc ;-)

Corrosive
09-16-2008, 06:50 AM
Not sure why you guys would think that one HTML attribute would exclude another one in the first place.. :-/

I blame an over reliance on design view. There may be a way of applying an id and a class to a div in design view but I've not found it yet. I now find that code view will happily 'hint' that you can do this and I use it quite a bit. You know I am self-taught and just need a little nudge in the right direction every now and again :)

Ariel
09-16-2008, 11:59 PM
There may be a way of applying an id and a class to a div in design view but I've not found it yet.
Corrosive, I'm not sure if this will help but if you:

1. In design view look just below the viewing window where your page is shown and you will see a small "tag selector" bar.
2. Right click on the div to which you want to apply an ID or class.
3. There will be a drop down menu.
4. Click on "set class" or "set ID"
5. Your list of classes or IDs should be in either list.

:)

Corrosive
09-17-2008, 06:55 AM
Corrosive, I'm not sure if this will help but if you:

1. In design view look just below the viewing window where your page is shown and you will see a small "tag selector" bar.
2. Right click on the div to which you want to apply an ID or class.
3. There will be a drop down menu.
4. Click on "set class" or "set ID"
5. Your list of classes or IDs should be in either list.

:)

Thanks Ariel, much appreciated. To be honest I try and stay away from design view other than having a rough check that everything is OK but that is useful to know :)

Ariel
09-17-2008, 06:43 PM
You are very welcome, Corrosive. I'm glad that I remembered that little trick. Actually, I learned it in Mastering CSS with Dreamweaver CS3, by Stephanie Sullivan and Greg Rewis.

I know what you mean about working more and more in code. Of late, I am falling into the same habit. :)

Corrosive
09-17-2008, 07:01 PM
You are very welcome, Corrosive. I'm glad that I remembered that little trick. Actually, I learned it in Mastering CSS with Dreamweaver CS3, by Stephanie Sullivan and Greg Rewis.

I know what you mean about working more and more in code. Of late, I am falling into the same habit. :)

It's a good habit I think. :)

Pitter
09-23-2008, 11:32 AM
My favorite programming language cashing style sheet> I follow this website
***. Please log in and enjoyed this Programming.
Its very interesting Programming language.This website Provide more article on CSS Programming.
more detail
****

domedia
09-23-2008, 01:30 PM
spammer go away

Death Dream
09-23-2008, 02:16 PM
spammer go away

I was kinda wondering why this post was still alive lol. Noticed the site has been getting spammed a bit more often.

~Death Dream~