Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将图片与CSS对齐会导致Firefox/Windows出现问题,但不会导致Firefox/linux出现问题_Css_Windows_Linux_Firefox_Vertical Alignment - Fatal编程技术网

将图片与CSS对齐会导致Firefox/Windows出现问题,但不会导致Firefox/linux出现问题

将图片与CSS对齐会导致Firefox/Windows出现问题,但不会导致Firefox/linux出现问题,css,windows,linux,firefox,vertical-alignment,Css,Windows,Linux,Firefox,Vertical Alignment,关于CSS、Firefox和Windows,我有一个奇怪的错误 让我解释一下:我使用 vertical-align:sub; 。。。它在Linux上的Firefox和Windows上的IE上都能正确显示,但在Firefox和Windows上却不能。我在Linux和Windows上使用相同版本的Firefox 问题的一些图片(很抱歉给您带来不便,但我无法发布图片或超过2个链接,因此我必须这样做): 链接到页面: 如果我摆弄垂直对齐我可以让它在Win上与FF一起工作,但它会弄乱其他组合。我会这样

关于CSS、Firefox和Windows,我有一个奇怪的错误

让我解释一下:我使用

vertical-align:sub;
。。。它在Linux上的Firefox和Windows上的IE上都能正确显示,但在Firefox和Windows上却不能。我在Linux和Windows上使用相同版本的Firefox

问题的一些图片(很抱歉给您带来不便,但我无法发布图片或超过2个链接,因此我必须这样做):

链接到页面:


如果我摆弄
垂直对齐
我可以让它在Win上与FF一起工作,但它会弄乱其他组合。

我会这样做:

CSS

ul li a img
{
    margin:2px 5px 0 0;
    border:0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}​
ul li a i
{
    background:url(/sprites.png) no-repeat;
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background-position:0 0;
}
ul li a i
{
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background:url(/deutsch.png) no-repeat center center;
}
将此添加到CSS文件:

ul
{
    margin:0;
    padding:0;
}
ul li
{
    margin:0 0 0 3px;
    padding:0;
    display:inline-block;
    list-style-type:none;
}
ul li:first-child
{
    margin-left:0;
}
ul li a
{
    padding:3px 8px;
    display:block;
    font-weight:bold;
    text-decoration:none;
    color:#fff;
    background-color:#000;
}
ul li a i
{
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
    background:url(/sprites.png) no-repeat;/*your img file here*/
}​
HTML

<ul>
    <li>
        <a href=""><img src="/deutsch.png">Deutsch</a>
    </li>
</ul>
<ul>
    <li>
        <a href=""><i class="deutsch"></i>Deutsch</a>
    </li>
</ul>
您的HTML代码应该是这样的:

<ul>
    <li>
        <a href=""><i></i>Lang 1</a>
    </li><li>
        <a href=""><i></i>Lang 1</a>
    </li><li>
        <a href=""><i></i>Lang 1</a>
    </li>
</ul>  
HTML

<ul>
    <li>
        <a href=""><img src="/deutsch.png">Deutsch</a>
    </li>
</ul>
<ul>
    <li>
        <a href=""><i class="deutsch"></i>Deutsch</a>
    </li>
</ul>
解决方案3(不带图像精灵):

CSS

ul li a img
{
    margin:2px 5px 0 0;
    border:0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}​
ul li a i
{
    background:url(/sprites.png) no-repeat;
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background-position:0 0;
}
ul li a i
{
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background:url(/deutsch.png) no-repeat center center;
}
HTML

<ul>
    <li>
        <a href=""><img src="/deutsch.png">Deutsch</a>
    </li>
</ul>
<ul>
    <li>
        <a href=""><i class="deutsch"></i>Deutsch</a>
    </li>
</ul>

我会这样做:

CSS

ul li a img
{
    margin:2px 5px 0 0;
    border:0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}​
ul li a i
{
    background:url(/sprites.png) no-repeat;
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background-position:0 0;
}
ul li a i
{
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background:url(/deutsch.png) no-repeat center center;
}
将此添加到CSS文件:

ul
{
    margin:0;
    padding:0;
}
ul li
{
    margin:0 0 0 3px;
    padding:0;
    display:inline-block;
    list-style-type:none;
}
ul li:first-child
{
    margin-left:0;
}
ul li a
{
    padding:3px 8px;
    display:block;
    font-weight:bold;
    text-decoration:none;
    color:#fff;
    background-color:#000;
}
ul li a i
{
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
    background:url(/sprites.png) no-repeat;/*your img file here*/
}​
HTML

<ul>
    <li>
        <a href=""><img src="/deutsch.png">Deutsch</a>
    </li>
</ul>
<ul>
    <li>
        <a href=""><i class="deutsch"></i>Deutsch</a>
    </li>
</ul>
您的HTML代码应该是这样的:

<ul>
    <li>
        <a href=""><i></i>Lang 1</a>
    </li><li>
        <a href=""><i></i>Lang 1</a>
    </li><li>
        <a href=""><i></i>Lang 1</a>
    </li>
</ul>  
HTML

<ul>
    <li>
        <a href=""><img src="/deutsch.png">Deutsch</a>
    </li>
</ul>
<ul>
    <li>
        <a href=""><i class="deutsch"></i>Deutsch</a>
    </li>
</ul>
解决方案3(不带图像精灵):

CSS

ul li a img
{
    margin:2px 5px 0 0;
    border:0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}​
ul li a i
{
    background:url(/sprites.png) no-repeat;
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background-position:0 0;
}
ul li a i
{
    margin:2px 5px 0 0;
    display:block;
    float:left;
    width:20px;/* width of your img */
    height:15px;/* height of your img */
}

ul li a i.deutsch
{
    background:url(/deutsch.png) no-repeat center center;
}
HTML

<ul>
    <li>
        <a href=""><img src="/deutsch.png">Deutsch</a>
    </li>
</ul>
<ul>
    <li>
        <a href=""><i class="deutsch"></i>Deutsch</a>
    </li>
</ul>

您的菜单项似乎显示正确,但图像显示不正确。能否检查图像的“背景位置”属性并尝试设置图像的位置?如果你能为我们提供一个工作的html/css链接,那么它将有助于帮助你。谢谢,抱歉,当我试图取悦一个新来者所面临的所有限制时,我似乎已经删除了链接->添加了链接。垂直对齐仅适用于图像。似乎菜单项显示正确,但图像显示不正确。能否检查图像的“背景位置”属性并尝试设置图像的位置?如果你能为我们提供一个工作的html/css链接,那么它将有助于帮助你。谢谢,抱歉,当我试图取悦一个新来者所面临的所有限制时,我似乎已经删除了链接->添加了链接。垂直对齐仅适用于图像。感谢您的回答,看起来很有趣,但它是否适用于多个图像?我想我可以把课程放在那里,而不仅仅是我,但这似乎有点“黑客”。不管怎样,我还是要试试。我以前有图像精灵,但是旧的浏览器在正确显示它们方面有问题,所以我回到了单一图像。这已经很危险了,但那个下拉菜单已经更新了我的答案。:)也许这会有帮助。好的,用边距参数替换垂直对齐是通用的。我还希望能找到一个解决方案,解释为什么Firefox的功能依赖于操作系统,我觉得这很奇怪。谢谢你的回答,看起来很有趣,但它能处理多个图像吗?我想我可以把课程放在那里,而不仅仅是我,但这似乎有点“黑客”。不管怎样,我还是要试试。我以前有图像精灵,但是旧的浏览器在正确显示它们方面有问题,所以我回到了单一图像。这已经很危险了,但那个下拉菜单已经更新了我的答案。:)也许这会有帮助。好的,用边距参数替换垂直对齐是通用的。我还希望找到一个解决方案,来解释为什么Firefox的功能依赖于操作系统,我觉得这很奇怪。