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框架之二—核心思路详解... 如何读源码 jQuery 整体框架甚是复杂,也不易读懂。但是若想要在前端的路上走得更远、更好,研究分析前端的框架无疑是进阶路上必经之路。但是庞大的源码往往让我们不知道从何处开始下手。在很长的时间里我也被这种问题困扰着,自己也慢...
Declarative Tabular Form dynamic totals A common Apex project is to take a customer’s existing spreadsheet-based solution and convert it more-or-less as is into...
Why can I run multiple functions on a single line ... E.g.: $(".element").fadeOut().delay(500).fadeIn(); Why can I run multiple functions on a single jQuer...
Listview jquery mobile php I have created following query, which shows results from a mysql database and fetched in the phonegap app. I want to dis...
Can I have the improved look of the jQueryUI butto... I like the general look of the jquery ui button, but it is oversized for my purposes. Is there a way to replace the b...