473,231 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Center image doesn't work

2
I'm trying to get my photo's centered. In my current layout it works, but I'm changing the design of my website.

In the source it calls voor myinlinepicture

In source:

<div class="post-body">
<div>
<p> ......</p>
<div class="myinlinepicture" style="width:400px">
</div>

I searched some forums and set my css like this:

In CSS:

.myinlinepicture {
text-align:center;
margin:0px auto 0px auto;
}

It should center right now, but it doesn't. What else can be the problem?
Sep 30 '07 #1
5 2779
drhowarddrfine
7,435 Expert 4TB
You are applying the margins to the <div> and not the image. <div> is block level while <img> is inline. Apply
img{
margin:0 auto;
display:block;
}
Sep 30 '07 #2
try
<center><table width=98%><tr><td><img src="yourpic.gif" alt="alternate name"></td></tr></table></center>
and just change the % to suit
Oct 1 '07 #3
drhowarddrfine
7,435 Expert 4TB
<center> has been deprecated for years and you should never use tables for layout.
Oct 1 '07 #4
Maaike
2
You are applying the margins to the <div> and not the image. <div> is block level while <img> is inline. Apply
img{
margin:0 auto;
display:block;
}
The problem is I'm using Wordpress with a plugin for the pictures. The suggestion you did, had an effect on the pictures in my gallery, but not on the pictures in my post. So there must be something in my post css that is overruling my picture css.
Is there something else I can try?
Oct 1 '07 #5
drhowarddrfine
7,435 Expert 4TB
.myinlinepicture img{
margin:0 auto;
display:block;
}

That makes it specific to that div. If that doesn't work, a link is necessary to see what it's doing.
Oct 1 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Tony Vasquez | last post by:
Can somoene give me an example of how to center a div, according to it's image size... I am using different images, and so I have to resize it in a functino according to the image's size. So I use...
13
by: Mike | last post by:
We are using: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"...
2
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center...
1
by: Troels Arvin | last post by:
Hello, publib.boulder.ibm.com has been rather unstable lately, so I figured I should install a local copy of the documentation web pages. I grabbed the Windows-version of the offline version...
19
roula
by: roula | last post by:
I HATE DIVS AND DIFFERENT BROWSERS!!! i spent the whole day and night searching for a way to center align stupid divs, the problem is that the code is so sensitive, i lost my mind trying to make them...
1
by: judacris | last post by:
I've seen the threads here about molding 2 divs in a centered fashion. but I can't seem to solve this thing. my blogger blog is functioning well on my site for now, but the blog feed (left) and...
14
by: Summercool | last post by:
in http://www.0011.com/test_size3.html to center the logo "HTML 4.01 check" button at the bottom of the page, I used <div style="width: 10px; margin: 0px auto"> </div>
24
by: GloStix | last post by:
I'm trying to center this banner, it's in a div that has the same width so it's not exactly "centering" but it's screwed up, It works in safari but in Firefox it's messed up. I uploaded a Video to...
14
by: gaijinco | last post by:
I was a hobbist web coder for years but I had to sidestep for a while. Now I'm trying to return to it and I'm trying to clarify how am I supposed to do somethings with CSS v.s. HTML and I'm...
13
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.