[pmwiki-users] Re: margin around image

H. Fox haganfox at gmail.com
Sat Jul 9 17:19:09 CDT 2005


On 7/8/05, Henrik Bechmann <henrik.bechmann at sympatico.ca> wrote:
> >>unless the margin was somehow possible before
> and I didn't know it<<
> 
> put the following into your template header:
> 
> <style type="text/css">
> img {margin:3px;}
> </style>

That's similar to another suggested solution, except it puts a margin
around all images by default rather than just images withing the
wikitext.

On 7/9/05, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Sat, Jul 09, 2005 at 02:57:57AM -0700, H. Fox wrote:
> > ps:  Does anyone have a good reason *not* to make the following line
> > (possibly with pixel values adjusted) part of the distributed
> > pmwiki.css stylesheet?  IMHO doing so would put reasonable default
> > margins around images in PmWiki pages.
> >
> > #wikitext img {margin-left:5px; margin-right:8px;  margin-bottom:1px;
> > margin-top:4px;}
> 
> Two potential problems:  (1)  As written above the margins are no
> longer "defaults" but mandatory settings -- there's no simple way
> for an author to change or eliminate the images' margin settings,
> and (2) it's too general, it puts margins on images (especially
> non-floating) where they aren't wanted.  So, if a site is using
> wikismileys, or images to visually tag links to external sites,
> then those images get margins added to them as well.

A third problem would be that SideBar images would not be affected by
that CSS selector.

> I suspect the answer is going to be that we predefine %imageleft%
> and %imageright% wikistyles that provide appropriate margins
> and get authors to use those.

Can PmWiki distinguish if it's an image (rather than some other block
element) being styled?  If so, there might be another possible
solution that would ease the burden on wiki authors.

As of now, here's a typical <img> tag:

<img src='http://example.localnet/path/to/pmwiki-32.gif'
style='border:0px;' alt='' />

If changes discussed in another thread happen, this will be

<img src='http://example.localnet/path/to/pmwiki-32.gif' alt='' />

meaning an image styled with %align=left% would look like this:

<img align='left'  src='http://example.localnet/path/to/pmwiki-32.gif' alt='' />

If PmWiki can distinguish that it's an image (not something else)
being styled, an image styled with %align=left% could look like this:

<img align='left' style='margin-right:8px;  margin-bottom:1px;
margin-top:4px;'  src='http://example.localnet/path/to/pmwiki-32.gif'
alt='' />

and an image styled with %align=right% could look like this:

<img align='right' style='margin-left:8px; margin-right:4px;
margin-bottom:1px; margin-top:4px;' 
src='http://example.localnet/path/to/pmwiki-32.gif' alt='' />

where there's some variable defining the margins for left-aligned and
right-aligned images.

Hagan




More information about the pmwiki-users mailing list