IE7 中的 UL 对齐问题

发布于 2025-01-02 11:46:59 字数 4906 浏览 0 评论 0原文

我无法弄清楚 IE7 中的无序列表有什么问题。有些子弹未对齐,有些则根本不显示。

http://dl.bearce.me/bullet-problem.jpg

第 1 组和3 组的 CSS

ul {
    color: #C20000;
    list-style: square url("../images/li-square.jpg");
    margin: 0 0 25px 15px;
}

    ul li {
        color: #333;
        font-family: Arial, sans-serif;
        font-size: 14px;
        font-weight: normal;
        line-height: 24px;
    }

/* (specific to Group 3 */

    ul.half {
        float: left;
        width: 295px;
    }
    ul.third {
        float: left;
        width: 191px;
    }

组 1 的 HTML

<div class="col">
    <h1>Exterior Services</h1>
    <ul>
        <li><a href="services-exterior-snow-removal.htm">Snow &amp; Ice Removal</a></li>
        <li><a href="services-exterior-landscaping.htm">Landscaping &amp; Maintenance</a></li>
        <li><a href="services-exterior-parking-lots.htm">Parking Lot Maintenance</a></li>
        <li><a href="services-exterior-window-washing.htm">Windows &amp; Power Washing</a></li>
        <li><a href="services-exterior-general-repair.htm">General Repair Maintenance</a></li>
    </ul>
</div><!--/.col-->
<div class="col">
    <h1>Interior Services</h1>
    <ul>
        <li><a href="services-interior-janitorial.htm">Janitorial</a></li>
        <li><a href="services-interior-electrical.htm">Electrical &amp; Lighting</a></li>
        <li><a href="services-interior-plumbing-hvac.htm">Plumbing &amp; HVAC</a></li>
        <li><a href="services-interior-maintenance.htm">Preventative Maintenance Programs</a></li>
        <li><a href="services-emergency.htm">Emergency Services</a></li>
    </ul>
</div><!--/.col-->

组 3 的 HTML

<ul class="half" style="width:345px;">                  
    <li>Back-up generators and power supply</li>
    <li>Carbon monoxide detectors</li>
    <li>Circuit-breaker conversions</li>
    <li>Electrical upgrades</li>
    <li>Fuse and breaker change-outs</li>
    <li>Indoor and outdoor lighting (including security)</li>                   
</ul>               
<ul class="third">
    <li>Low-voltage wiring</li>
    <li>Safety inspections</li>
    <li>Smoke detectors</li>
    <li>Surge protection</li>
    <li>Switches, sockets and outlets</li>
    <li>Troubleshooting</li>                
</ul>

组 2 的 CSS

#sidebar ul {
    list-style: disc url("../images/li-disc.jpg");
    list-style-position: inside;
    margin: 0;
}

    #sidebar ul li {
        border-bottom: 1px solid #dadada;
        color: #000;
        font-weight: bold;
        padding: 5px 0;
    }

    #sidebar ul li:first-child {
        border-top: 1px solid #dadada;
    }

组 2 的 HTML

<div id="sidebar">

    <h3>exterior Services</h3>              
    <ul>
        <li><a href="services-exterior-snow-removal.htm">Snow &amp; Ice Removal</a></li>
        <li><a href="services-exterior-landscaping.htm">Landscaping &amp; Maintenance</a></li>
        <li><a href="services-exterior-parking-lots.htm">Parking Lot Maintenance</a></li>
        <li><a href="services-exterior-window-washing.htm">Windows &amp; Power Washing</a></li>
        <li><a href="services-exterior-general-repair.htm">General Repair Maintenance</a></li>
    </ul>
    <h3>interior Services</h3>
    <ul>
        <li><a href="services-interior-janitorial.htm">Janitorial</a></li>
        <li><a href="services-interior-electrical.htm">Electrical &amp; Lighting</a></li>
        <li><a href="services-interior-plumbing-hvac.htm">Plumbing &amp; HVAC</a></li>
        <!-- <li><a href="services-interior-maiintenance.htm">Interior Maintenance</a></li> -->
    </ul>
    <h3>24/7/365</h3>
    <ul>
        <li><a href="services-preventative-maintenance.htm">Preventative Maintenance Programs</a></li>
        <li><a href="services-emergency.htm">Emergency Services</a></li>
    </ul>

</div><!--/#sidebar-->

I'm having trouble figure out what the problem is with my unordered lists in IE7. Some of bullets are misaligned, and others don't show up at all.

http://dl.bearce.me/bullet-problem.jpg

Group 1 and 3's CSS

ul {
    color: #C20000;
    list-style: square url("../images/li-square.jpg");
    margin: 0 0 25px 15px;
}

    ul li {
        color: #333;
        font-family: Arial, sans-serif;
        font-size: 14px;
        font-weight: normal;
        line-height: 24px;
    }

/* (specific to Group 3 */

    ul.half {
        float: left;
        width: 295px;
    }
    ul.third {
        float: left;
        width: 191px;
    }

Group 1's HTML

<div class="col">
    <h1>Exterior Services</h1>
    <ul>
        <li><a href="services-exterior-snow-removal.htm">Snow & Ice Removal</a></li>
        <li><a href="services-exterior-landscaping.htm">Landscaping & Maintenance</a></li>
        <li><a href="services-exterior-parking-lots.htm">Parking Lot Maintenance</a></li>
        <li><a href="services-exterior-window-washing.htm">Windows & Power Washing</a></li>
        <li><a href="services-exterior-general-repair.htm">General Repair Maintenance</a></li>
    </ul>
</div><!--/.col-->
<div class="col">
    <h1>Interior Services</h1>
    <ul>
        <li><a href="services-interior-janitorial.htm">Janitorial</a></li>
        <li><a href="services-interior-electrical.htm">Electrical & Lighting</a></li>
        <li><a href="services-interior-plumbing-hvac.htm">Plumbing & HVAC</a></li>
        <li><a href="services-interior-maintenance.htm">Preventative Maintenance Programs</a></li>
        <li><a href="services-emergency.htm">Emergency Services</a></li>
    </ul>
</div><!--/.col-->

Group 3's HTML

<ul class="half" style="width:345px;">                  
    <li>Back-up generators and power supply</li>
    <li>Carbon monoxide detectors</li>
    <li>Circuit-breaker conversions</li>
    <li>Electrical upgrades</li>
    <li>Fuse and breaker change-outs</li>
    <li>Indoor and outdoor lighting (including security)</li>                   
</ul>               
<ul class="third">
    <li>Low-voltage wiring</li>
    <li>Safety inspections</li>
    <li>Smoke detectors</li>
    <li>Surge protection</li>
    <li>Switches, sockets and outlets</li>
    <li>Troubleshooting</li>                
</ul>

Group 2's CSS

#sidebar ul {
    list-style: disc url("../images/li-disc.jpg");
    list-style-position: inside;
    margin: 0;
}

    #sidebar ul li {
        border-bottom: 1px solid #dadada;
        color: #000;
        font-weight: bold;
        padding: 5px 0;
    }

    #sidebar ul li:first-child {
        border-top: 1px solid #dadada;
    }

Group 2's HTML

<div id="sidebar">

    <h3>exterior Services</h3>              
    <ul>
        <li><a href="services-exterior-snow-removal.htm">Snow & Ice Removal</a></li>
        <li><a href="services-exterior-landscaping.htm">Landscaping & Maintenance</a></li>
        <li><a href="services-exterior-parking-lots.htm">Parking Lot Maintenance</a></li>
        <li><a href="services-exterior-window-washing.htm">Windows & Power Washing</a></li>
        <li><a href="services-exterior-general-repair.htm">General Repair Maintenance</a></li>
    </ul>
    <h3>interior Services</h3>
    <ul>
        <li><a href="services-interior-janitorial.htm">Janitorial</a></li>
        <li><a href="services-interior-electrical.htm">Electrical & Lighting</a></li>
        <li><a href="services-interior-plumbing-hvac.htm">Plumbing & HVAC</a></li>
        <!-- <li><a href="services-interior-maiintenance.htm">Interior Maintenance</a></li> -->
    </ul>
    <h3>24/7/365</h3>
    <ul>
        <li><a href="services-preventative-maintenance.htm">Preventative Maintenance Programs</a></li>
        <li><a href="services-emergency.htm">Emergency Services</a></li>
    </ul>

</div><!--/#sidebar-->

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提赋 2025-01-09 11:46:59

不要使用列表样式的图像。使用 CSS 背景。您无法轻松控制列表样式图像的位置。

另外,不要设置 LI 标记的样式,设置 A 标记的样式并使用 display:block

请参阅我的教程:

preview.moveable.com/JM/ilovelists

Don't use list-style image. Use a CSS background. You can't easily control the position of list-style-image.

Also, don't style the LI tag, Style the A-tag and use display:block;

See my tutorial:

preview.moveable.com/JM/ilovelists

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文