The image and text in Li are not aligned with Div + CSS. solution:

Source: Internet
Author: User
  1. <Style>
  2. Li {
  3. Margin: 2px 3px 3px 8px;
  4. Padding: 5px;
  5. Background: URL (/images/sider_siteinfo.gif) No-repeat 0 50%;
  6. List-style-type: none;
  7. List-style-position: inside;
  8. }
  9.  
  10. </Style>
  11.  
  12. <Div>
  13.  
  14. <Ul>
  15. <Li>Younger brother, debut, not familiar with life, please advise</Li>
  16. <Li>Younger brother, debut, not familiar with life, please advise</Li>
  17. <Li>Younger brother, debut, not familiar with life, please advise</Li>
  18. <Li>Younger brother, debut, not familiar with life, please advise</Li>
  19. <Li>Younger brother, debut, not familiar with life, please advise</Li>
  20. </Ul>
  21. </Div>
 
<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> younger brother, out of the road, unfamiliar with the world. Please advise </LI> <li> younger brother, debut, not familiar with life, please advise </LI> <li> younger brother, debut, not familiar with life, please advise </LI> <li> younger brother, debut, not familiar with life, please advise </LI> <li> younger brother, debut, not familiar with life. Please advise </LI> </ul> </div>
50% indicates vertical center!

Controls the content spacing between images and Li.
1. acceleration can increase the spacing.
2. Padding-left controls the content spacing between the image and Li:

    1. <Style>
    2. Li {
    3. Margin: 2px 3px 3px 8px;
    4. Padding-left: 25px;
    5. Background: URL (/images/sider_siteinfo.gif) No-repeat 0 50%;
    6. List-style-type: none;
    7. List-style-position: inside;
    8. }
 
<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, addVertical-align: Middle

  1. <Ul>
  2. <Li> <IMG Style= 'Vertical-align: middle'SRC='Icon01.gif' />Align the image with me.</Li>
  3. LI IMG style = 'vertical-align: middle' SRC using 'icon01.gif ' /> align the image with mE LI
  4. LI > IMG style = 'vertical-align: middle' SRC using 'icon01.gif ' /> align the image with mE LI
  5. LI IMG style = 'vertical-align: middle' SRC using 'icon01.gif ' /> align the image with mE LI
  6. <Li> <IMG Style='Vertical-align: middle' SRCInvalid 'icon01.gif'/>Align the image with me.</Li>
  7. </Ul>
 
  
  
  • the image above must be aligned with mE
  • the image above must be aligned with mE
  • the image above must be aligned with mE
  • the image above must be aligned with mE
  • align the image with mE
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.