How do I center an image in my browser?

综合技术 2018-05-16


I want to center an image in a webpage both horizontally and vertically
. I tried using the following JQuery and I can't figure out what I'm doing wrong.

The webpage is here:

This is the JQuery I'm using:

I've put the js file here:

I'm new here so this website allows me to post only one link in my question. Any help is appreciated. Thanks!

Something as simple as this would do the trick. I decided to leave my answer (The others are correct) not only to show a solution to your current problem, but also to suggest scrapping the paragraph tag (It isn't necessary) and to suggest adding an alt description to your image tag.

This css:

#container {text-align: center;}

And this html:

Should be all you need for a website this simple.

Hello, buddy!

责编内容by:Hello, buddy! (源链)。感谢您的支持!


Check page load I've got a set of radiobuttons on my page. When you select any one of them, I'm forcing a postback t...
前端本地文件操作与上传3 前端无法像原生APP一样直接操作本地文件,否则的话打开个网页就能把用户电脑上的文件偷光了,所以需要通过用户触发,用户可通过以下三种方式操作触发: 通过input type=”file...
How can I animate a DOM element using transitions ... I've been trying to animate DOM elements using transitions alone, since I've read they're bett...
python web py入门(44)- jQuery 事件 – 函数表达式... 在前面学习jQuery的事件处理的方法ready(),在这里碰到这样一个语法: $('h1').click( function(event){ alert("jQuery在工作中!"); ...
Pass JSON to JQuery function Javascript We have a very simpel Google Apps Script Web App, which purpose is to show JSON data in a HTML drop...