PDA

View Full Version : styling a photobox !


spazzer
11-14-2009, 10:16 AM
Hi,
I would like to create a style to go round all my images on my site but then want the option tio either float it left or right !
Ideally I would create a style .photobox with padding and border colour etc ,is there a way to then to apply a style to the photbox to float it left or right, (this would mean I would be styling a style !), then if I changed the photobox style to a different colour say it would apply to both left and right floated boxes without having to create a leftphotobox style and a rightphotobox style with the same styles repeated apart from the float properties !

Can anyone advise,
Nick C ;-)

Corrosive
11-14-2009, 10:50 AM
you can apply two classes to your image (or div) tags...

<img class="photobox left"></img>
<img class="photobox right"></img>

Then create your three classes in CSS...

.photobox {
border: 5px solid #fff;
}
.left {
float: left;
}
.right {
float: right;
}

Hope this helps

gentleone
11-14-2009, 10:50 AM
You can give more then one class to an element separated with a space, but don't overdo this. Keep it at a maximum of two.

div class="photobox left"></div>
div class="photobox right"></div>

Oh... hahaha... Corrosive, you were just quicker with the answer :)

spazzer
11-14-2009, 11:18 AM
Thanks Guys,
Do I need to type this in manually directly into the code or can it be done within dreamweaver itself ?

Cheers

Corrosive
11-14-2009, 11:27 AM
Does it matter? You've been here for 76 posts I would expect you to have at least started peaking at the code you have created. Go and get your hands dirty, it is the only way you will become a proficient designer IMO.

gentleone
11-14-2009, 11:30 AM
The div you can, but the CSS you have to type in.

Insert --> Layout Objects --> Div Tag --> name the classes --> Enter