Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » Image spacing

#1 2006-08-19 16:22:41

toni1
Member
Registered: 2006-04-21
Posts: 14

Image spacing

Hello,
I want to leave some space around images in articles. But at the same time I have some images that must not have space around them. That’s why I cannot use the following line

img
{ margin: 10px;
}

How can I apply it only to specific images?

Is there a way to tell all text to stay 10px away from images?
Thanks

Offline

#2 2006-08-19 16:40:17

reid
Member
From: Atlanta, Ga.
Registered: 2004-04-04
Posts: 224
Website

Re: Image spacing

toni1 wrote:

How can I apply it only to specific images?

If most of your images require no margin, then you should add a special class on the ones where you do want a margin:

HTML:
<code>
<img class=“somespace” />
</code>
CSS:
<code>
img.somespace {
margin: 10px;
}
</code>

Alternately, give the images you want to have no margin a special class:

HTML:
<code>
<img class=“nospace” />
</code>
CSS:
<code>
img.nospace {
margin: 0px;
}
</code>


TextPattern user since 04/04/04

Offline

#3 2006-08-19 16:55:17

toni1
Member
Registered: 2006-04-21
Posts: 14

Re: Image spacing

and how do I give the text spacing?

Offline

#4 2006-08-19 18:53:44

reid
Member
From: Atlanta, Ga.
Registered: 2004-04-04
Posts: 224
Website

Re: Image spacing

Well, you could place the margin on the p tag instead, but the effect is the same … 10px of space between image and text.


TextPattern user since 04/04/04

Offline

#5 2006-08-19 21:02:25

toni1
Member
Registered: 2006-04-21
Posts: 14

Re: Image spacing

That is what I need! I want to have no space between two images, but keep the text away. How do I place it on the p tag?

Offline

#6 2006-08-20 02:16:35

reid
Member
From: Atlanta, Ga.
Registered: 2004-04-04
Posts: 224
Website

Re: Image spacing

You can use:

p {
margin: 10px 10px 1em 10px;
}

…but that will keep the text ten pixels away from everything , not just images, and leave a one line break at the end of each paragraph before new text.


TextPattern user since 04/04/04

Offline

  1. Index
  2. » Archives
  3. » Image spacing

Board footer

Powered by FluxBB