Page 1 of 1
Image margins - is it me? <Solved>
Posted: Fri Jan 26, 2007 1:50 am
by keithbrook
Hello Lovely People
I've looked at previous posts, but I'm struggling with image margins inside the {content} section.
If I embed a style with 'margin: 10' inside the img tag on the page it works, but I'd rather use stylesheets.
I'm using the supplied 'Left simple navigation + 1 column' template and 'Layout: Left sidebar + 1 column' css while I learn about all this brilliant CMS system.
Earlier posts suggested changing the 'img' tag in css to achieve a margin. I've tried this and it has no effect for me.
What am I doing wrong?
Thanks in advance!!!
Keith
Re: Image margins - is it me?
Posted: Fri Jan 26, 2007 2:42 am
by heatherfeuer
Hi! I had the same problem. I hate it when the text bumps up right against an embedded image. What worked for me was to add an extra style to the 'img' tag in the main stylesheet. The style for img looks like this:
Code: Select all
img {
border: none; /* Prevents images inside an "a" tag from showing a border */
margin: .5em; /* Puts some air between images and surrounding text */
}
You can experiment with the margin, but .5em worked well for me.
Re: Image margins - is it me?
Posted: Fri Jan 26, 2007 9:51 am
by keithbrook
Thanks for that Heather.
Strangely, margins: 20 and margins: 20px didn't work for me but .5em does.
You've saved me a load of coding.
By the way, your logo reminds me of a previous girlfriend from Texas. Did I say that? Yes I did!!!
Many thanks again.
Keith
Re: Image margins - is it me?
Posted: Fri Jan 26, 2007 10:33 am
by Dr.CSS
"Strangely, margins: 20 and margins: 20px didn't work for me but .5em does. "
margins: 20 or 20px will not work because CSS only understands margin: no s...
You can also target specific images using the div id/class...
#main img {margin: 20px}, margin/padding work clockwise margin: 5px top 5px right 5px bottom 5px left...
Leaving one of them out will give various results, leave one out and you get top, right/left, bottom,,, 2 out, top/bottom, left/right,,, 3 out, top/bottom/left/right...
Re: Image margins - is it me?
Posted: Fri Jan 26, 2007 11:10 am
by keithbrook
Thanks for that, Mark.
It was a typo on my part in the previous post.
However, it's working with 'margin' now, so maybe I did mistype it.
Perhaps the combination of old age and copious amounts of red wine!!!
Thanks for the '#main img {margin: 20px}' tip as well.
This is a great forum and a great CMS as well.
Now, how do I make a real estate CMS...........ah, there's something on the forum!!!!
Thanks again.