Centering problem, please ask a master_html/css_WEB-ITnose
<style type="text/css">body{ text-align:center;}li{ background-image:url(images/btn3.jpg); float:left; list-style-type:none; width:155px; height:58px; text-align:center; color:#F09; font-weight:bold; font-size:16px; font-family:Arial, Helvetica, sans-serif;}</style></head><ul> <li></br>Gift</li> <li></br>I,Say</li> <li></br>Photo</li> <li></br>Letter</li></ul>
This li still cannot be centered. I have tried various methods. Please help me. How can I control the position of the button on the page? CSS seems to be difficult to use, so I should use it. Wrong
Reply to discussion (solution)
float:left; will not be centered because it has escaped the document flow. You It can be changed to display:inline;
dispaly:inline; I tried it, but there was no floating effect. I removed the background image of li and it can be centered. What happened?
was added to ul. For a div, set the width, and then margin: 0 auto; in this case, the entire ul should be in the center
It is best to clear the float after the ul
Give ul width, then margin-left:-width. Then use position: relative, and it’s done.
Thank you, everyone, it’s easy to use. Thank you.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.
