English 中文(简体)
为什么这个 html/cs 看上去不同 在火狐和ie?
原标题:Why this html/css looks different in firefox and ie?
  • 时间:2012-05-22 14:30:21
  •  标签:
  • html
  • css

css:

  * {
        margin:0;
        padding:0;
    }

    .blue-button
    {
        width:auto;
        display:inline-block;
    }

    .blue-button:before
    {
        /*background-image:url( blue-button.gif );*/
        background:red;
        width:5px;
        height:21px;
        display:block;
        content:"0a0";";
        float:left;
    }

    .blue-button span
    {
        background:#00AEEF;
        display:block;
        height:100%;
        text-align:center;
        margin-left:5px;

        padding:3px;
        padding-left:8px;
        padding-right:8px;
        color:white;
    }

圆体 :

<div class="blue-button"><span>abcdef</span></div>

因此,基本上这只是一个 div , 其预设 < div 使用 before 。 我希望 span 在. bluue- button 内部重新缩放文本。 它对铬很管用, 但在 IE/FF 上却失败了。 在那些蓝色 div 浏览器中的下一行是( 它应该与 red div 在同一行) 。 我如何修正它?

最佳回答

这是一个问题,因为 IE 无法识别属性

display: inline-block;

IE 探索器将将其内嵌显示为内嵌, 并实现您给内容布局所需的预期效果

zoom: 1;

或类似。

这篇文章对我很有帮助, 检查一下,完全明白我想说什么!

http://flipc.blogspot.co.uk/2009/02/damn-ie7-and-inline-block.html

问题回答

我刚刚用你的代码设置了一个拼接器, FF也把红色和蓝色部分放在不同的行。 您的 CSS 中有一个错误, 当我修好它的时候, 固定了FF, 并在 IE8 中运行了罚款。 你对哪个版本的 IE 有问题吗?

content:"0a0";";

应该是

content:"0a0";

你能确认这只是个打字机 还是也帮你修好了?





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!