PDA

View Full Version : CSS rule for image borders in DW


roberts
12-09-2010, 03:35 PM
Hi

I want to create better looking borders im my DW site. As I understand, way to go, is new stylesheet to define borders. BUT, complicated thing is that I have tons of different images in my site and some of them uses border and some don't. I created new stylesheet and it applied new border to all images- the ones used borders before and also the ones who didn't.

As I don't understand HTML language well I couldn't figure how to define CSS rule which would apply my new border to all images where border is set 1px (border="1").
Can anyone give a hint how to make it work? It would be really helpful. Please do not offer to give ID for all images I need new border.

Thanks in advance!

Roberts

Corrosive
12-09-2010, 04:19 PM
img {border: 1px solid #000;}

Will do it.

roberts
12-09-2010, 04:33 PM
Thanks for answer!

I didn't get your idea or it was you..

Where do you want me to use "img {border: 1px solid #000;}"? It will create 1px solid black border around every image in my page. Even those who's border is set at border="0" now. I am searching for something that will add my new border to images which already uses, for example, 1px border, but for images that don't have borders to stay the way they are- without new border.

Corrosive
12-09-2010, 04:39 PM
I didn't get your idea or it was you..



Probably me to be honest ;)

I'm not getting it, you want to add a border to images that already have a border?

Corrosive
12-09-2010, 04:42 PM
Can you give me a link to view?

roberts
12-09-2010, 04:48 PM
Probably me to be honest ;)

I'm not getting it, you want to add a border to images that already have a border?

Bingo! Because I have some images with border="0" and I want them to stay as is

Corrosive
12-09-2010, 05:10 PM
OK, then target them with a class;

.image-border {border: 1px solid #000;}

then use that class in the img tag;

<img class="image-border" etc...

Obviously change the border styles to what you like, I have use black/solid as an example.

roberts
12-09-2010, 05:23 PM
That means I have to re-edit bunch of html documents which would have bunch of images in each of them..

I hoped for some code that would automate my border thing, otherwise I have to manually go and edit.

Could there be some chance to use variable IF and create code that actually would recognize all images with 1px border?

Corrosive
12-09-2010, 05:37 PM
Maybe. Javascript perhaps? Although that won't work if javascript disabled or some PHP but you're still going to have to paste at least an include in every page to do that. Maybe one of the code guys on here could make you something.

Corrosive
12-09-2010, 05:39 PM
Actually have you tried 'find and replace' in Dreamweaver?

roberts
12-09-2010, 05:55 PM
Hmm.. if Javascript will be only option to do it, I will probably use your suggestion and add image class with find and replace option.

Thanks for your suggestions Corrosive!

Corrosive
12-09-2010, 06:03 PM
You are welcome

DWcourse
12-10-2010, 03:12 AM
What is the new border supposed to look like? Will the width still be 1 pixel?

roberts
12-10-2010, 04:18 PM
Well, I am not 100% sure of final look of border, but it will be definately more than 1px width