Take pity on me please

holycow

New Member
I SOLVED MY PROBLEM, NEED NOT REPLY, I DON'T KNOW HOW TO DELETE POSTS

CENTERED, BUT NO LINK:
CSS:
img.center {
display: block;
margin-left: auto;
margin-right: auto;
}

HTML:
<img src="/images/bt1.jpg" width="relative" height="600" alt="1" class="center"/>
________

LINKED WITH SAME CSS
HTML:
<a href="IAMALINK"><img src="/images/bt1.jpg" width="relative" height="600" alt="1" /></a>
Here, the centering code isn't read anymore, so the image just hangs out to the left of the page.
________

LINK, MESSED UP CENTER:
<center><a href="IAMALINK"><img src="/images/bt1.jpg" width="relative" height="600" alt="1" /></a></center>

I don't know if I should be making a css command or what (I HAVE NO CLUE)...
As you can see, the third option is centering but only from the left edge of the image. Because the image has a determined height but relative width, I can't necessarily mark some position at the length if that was a possible solution. Is there a way that I can command the center to align differently? Do you have any alternative suggestions? I want to try to do this as cleanly as possible!

PLEASE HELP ME AND THANKS IN ADVANCE TO ANYONE WHO TAKES THE TIME TO REPLY! :)
 

Attachments

  • PROBLEM.jpg
    PROBLEM.jpg
    25.5 KB · Views: 24
Last edited:

chrishirst

Well-Known Member
Staff member
For margin: n auto; to work correctly, the element it is applied to MUST have a FIXED width of less than 100%.

AND ...

If you want an anchor element to constrain an inline element that is set with display: block, the anchor needs to be display: block as well.
 
Top