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!阅读原文】。感谢您的支持!


Jquery 操作 select 的操作指南 这里我们以一个简单的select作为原型来进行说明:香蕉1 香蕉2 香蕉3 香蕉4 香蕉5 香蕉6 香蕉7 香蕉8 香蕉9 ...
Jquery – Choosing a validation message durin... I'm building a page that renders a series of questions to the page, some of these questions have multiple options other might just require the user...
python web py入门(50)- jQuery – 输入内容的检查... 在前面学习了从网页上获取输入内容,它是通过jQuery的id选择器来实现的。一般情况之下,获取输入就是为了进行检查数据输入的正确性,那么怎么样判断数据的正确性,就跟你的业务逻辑有关了。比如qq的号码,全是数字;邮箱地址有一个@字符。下面就来学习怎么样检查一个合法的EMAIL地址,在这个例子里使用JS...
JQuery – ref div and href id in div I want to be able to know when someone clicks a link and then reference a var within the link that I assign as a ID. For example given a link like thi...
Is there a performance advantage for coding it in ... I am using jQuery 1.7.1 I am trying to write this code for readability as well as performance. In the two cases below, which one would perform bette...