Home html How to center the picture?

How to center the picture?

Author

Date

Category

There is a logo. Contained within the h1 tag of the logo class.
In CSS, #logo has text-align: left , I overload it in #logo img , write text-align: center . Even in the img tag I write align = "middle" . If only henna, it’s still on the left. The chrome and opera debuggers show that the image has a text-align: center property.

Just in case, this is how the calculated style looks like:

background-attachment: scroll;
background-clip: border-box;
background-color: #EEE;
background-image: url (header_outer.jpg);
background-origin: padding-box;
color: # 333;
display: block;
font-family: arial, helvetica, sans-serif;
font-size: 16px;
height: 1133px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
position: relative;
text-align: center;
width: 1263px;

Answer 1, authority 100%


Answer 2, authority 40%


Answer 3

It is not advisable to do the alignment in the css style sheet))) It is better to do this in the html code of the required page. To do this, in the & lt; div align = "center" & gt; & lt; / div & gt; tag or similarly in the & lt; table & gt; tag.

Or, for example, in your case something like this:

& lt; H1 & gt; & lt; img src = "../ images / picture.jpg" width = "200" height = "200" align = "middle" / & gt; Text centered on image & lt; / H1 & gt;

Or & lt; div align = "center" & gt; & lt; H1 & gt; & lt; img src = "../ images / picture.jpg" width = "200" height = "200" align = "middle "/ & gt; Text centered on image & lt; / H1 & gt; & lt; / div & gt;

Or another option:

The html code itself.

& lt; div class = "imgCenter" & gt;
  & lt; img src = "picture.jpg" border = "0" width = "200" height = "200" alt = "" / & gt;
& lt; / div & gt;

In the css property.

. imgCenter {text-align: center;}
Previous articleC++ Bubble Sort
Next articlePause in C #

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions