1 reply [Last post]
skyersk
skyersk's picture
User offline. Last seen 1 year 23 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-08-29
Posts: 1
Points: 2

Hello,
is there a way to add options (align=absmiddle exactly) for an image defined by content attribute? Code looks like:
#object:before {content:url('image.png');}

The thing I'm trying to do is to create page menu, with rounded images before and after it when hovered.

Thanks.

Stomme poes
Stomme poes's picture
User offline. Last seen 14 weeks 6 days ago. Offline
rank Elder
Elder
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Not tested.

I've never actually used content to put an image onscreen, so I'm not sure if it becomes an actual HTML image or a background. But assuming it's a foreground image:

#element:before {
content: url(theimage.png);
display: block;
width: whatever;
margin: 0 auto;
}

To use "align" in these Modern Days means "text-align" which must go on the block-level parent parent, and cannot go on the inline-level element (like img) itself. So making the image a block and centering it with automargins is your option to center it.

Are you going to be swapping these images around as the user interacts with the button?

I'm no expert, but I fake one on teh Internets