Home >Web Front-end >HTML Tutorial >The pictures and text in li are not aligned with div css, solution_html/css_WEB-ITnose

The pictures and text in li are not aligned with div css, solution_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 12:28:171538browse

c9ccee2e6ea535a969eb3f532ad9fe89 li{ margin: 2px 3px 3px 8px; padding: 5px; background: url(/images/sider_siteinfo.gif) no-repeat 0 50%; list-style -type: none; list-style-position: inside; } 531ac245ce3e4fe3d50054a55f265927 dc6dce4a544fdca2df29d5ac0ea9906b ff6d136ddc5fdfeffaf53ff6ee95f185 li> I’m making my debut, I’m not familiar with my place of birth, please give me some advicebed06894275b65c1ab86501b08a632eb I’m not familiar with it, please give me some advicebed06894275b65c1ab86501b08a632eb >

<style>li{    margin: 2px 3px 3px 8px;    padding: 5px;    background: url(/images/sider_siteinfo.gif) no-repeat 0 50%;    list-style-type: none;    list-style-position: inside;}</style><div><ul>  <li> 小弟,出道,人生地不熟,请各位指教</li>  <li> 小弟,出道,人生地不熟,请各位指教</li>  <li> 小弟,出道,人生地不熟,请各位指教</li>  <li> 小弟,出道,人生地不熟,请各位指教</li>  <li> 小弟,出道,人生地不熟,请各位指教</li></ul></div>

50% means vertical centering!

Control the spacing between the image and the content in LI
1. Add to increase the spacing
2. Padding-left to control the spacing between the image and the content in LI:


c9ccee2e6ea535a969eb3f532ad9fe89 li{ margin: 2px 3px 3px 8px; padding-left: 25px; background: url(/images/sider_siteinfo.gif) no-repeat 0 50%; list-style-type: none; list-style- position: inside; }

<style>li{    margin: 2px 3px 3px 8px;    padding-left: 25px;    background: url(/images/sider_siteinfo.gif) no-repeat 0 50%;    list-style-type: none;    list-style-position: inside;}
If the image is not in the background color, add vertical-align:middle

465b73e5b2561f715834fd1967740d1d 5d1e4b314c5d08905e8668261c679848The previous picture should be aligned with mebed06894275b65c1ab86501b08a632eb  25edfb22a4f469ecb59f1190150159c6 6ca9f49416c96c81a7f3425f04fcd670The previous picture should be aligned with mebed06894275b65c1ab86501b08a632eb  25edfb22a4f469ecb59f1190150159c6 5d1e4b314c5d08905e8668261c679848The previous picture should be aligned with mebed06894275b65c1ab86501b08a632eb /li>  25edfb22a4f469ecb59f1190150159c6 5d1e4b314c5d08905e8668261c679848The previous picture should be aligned with mebed06894275b65c1ab86501b08a632eb 929d1f5ca49e04fdcb27f9465b944689

<ul>  <li> <img style=‘vertical-align:middle' src='icon01.gif' />前面的图片要和我对齐</li>  <li> <img style='vertical-align:middle' src=‘icon01.gif' />前面的图片要和我对齐</li>  <li> <img style='vertical-align:middle' src=‘icon01.gif' />前面的图片要和我对齐</li>  <li> <img style='vertical-align:middle' src=‘icon01.gif' />前面的图片要和我对齐</li>  <li> <img style='vertical-align:middle' src=‘icon01.gif' />前面的图片要和我对齐</li></ul>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn