Html CSS没有将元素放在同一行

时间:2015-03-07 09:01:00

标签: html css html5 css3

我想把两个i元素放在同一行。     display:inline-block;  似乎没有为此工作。 这是我的HTML



#gamedesigner-topline {
  position: absolute;
  box-shadow: 0 0 0 2px #ffb141;
  color: #fff;
  transition: color 0.3s;
  display: inline-block !important;
  font-size: 0px;
  margin: 3px 30px 15px;
  width: 180px !important;
  height: 180px !important;
  border-radius: 50%;
  text-align: center;
  position: relative;
  z-index: 1;
  line-height: normal;
  vertical-align: baseline;
  background-image: none;
  background-position: 0% 0%;
  background-repeat: repeat;
  font-family: FontAwesome;
  font-weight: normal;
  font-style: normal;
  text-decoration: inherit;
  -webkit-font-smoothing: antialiased;
  left: 50px;
  background: #FAAC58;
}
#plugin-topline {
  position: absolute;
  box-shadow: 0 0 0 2px #ffb141;
  color: #fff;
  -webkit-transition: color 0.3s;
  -webkit-transition-property: color;
  -webkit-transition-duration: 0.3s;
  -webkit-transition-timing-function: initial;
  -moz-transition: color 0.3s;
  transition: color 0.3s;
  transition-property: color;
  transition-duration: 0.3s;
  transition-timing-function: initial;
  transition-delay: initial;
  display: inline-block !important;
  font-size: 0px;
  margin: 3px 30px 15px;
  width: 180px !important;
  height: 180px !important;
  border-radius: 50%;
  text-align: center;
  position: relative;
  z-index: 1;
  line-height: normal;
  vertical-align: baseline;
  background-image: none;
  background-position: 0% 0%;
  background-repeat: repeat;
  font-family: FontAwesome;
  font-weight: normal;
  font-style: normal;
  text-decoration: inherit;
  -webkit-font-smoothing: antialiased;
  left: 611px;
  background: #FAAC58;
}
.circles {
  display: inline-block;
}

<div class="circles">
  <a id="design">
    <i id="design-topline">
                            <img src="images\Home\designn.png">
                        </i>
  </a>
  <i id="plugin-topline">
                        <img src="images\Home\plugin.png">
                    </i>
</div>
&#13;
&#13;
&#13;

使用此CSS和HTML,在屏幕左侧,可以按照我想要的方式定位一个圆圈。然而,第二个圆圈位于我想要的屏幕的正确一侧,但似乎比第一个圆圈低很多,而不是在同一条线上。我如何将这个圆圈与第一个圆圈放在同一条线上。我称它为圆形,因为这就是CSS使i元素变成了像。

2 个答案:

答案 0 :(得分:-1)

将#plugin-topline的位置更改为relative,然后调整位置标记。

display: relative;

答案 1 :(得分:-1)

    Try this

.circles {
        position: relative;
        display: inline-block;
    }
    #design-topline {
        box-shadow: 0 0 0 2px #ffb141;
        color: #fff;
        transition: color 0.3s;
        display: inline-block !important;
        font-size: 0px;
        margin: 3px 30px 15px;
        width: 180px !important;
        height: 180px !important;
        border-radius: 50%;
        text-align: center;
        position: relative;
        z-index: 1;
        line-height: normal;
        vertical-align: baseline;
        background-image: none;
        background-position: 0% 0%;
        background-repeat: repeat;
        font-family: FontAwesome;
        font-weight: normal;
        font-style: normal;
        text-decoration: inherit;
        -webkit-font-smoothing: antialiased;
        left: 50px;
        background: #FAAC58;
    }
    #plugin-topline {
        box-shadow: 0 0 0 2px #ffb141;
        color: #fff;
        -webkit-transition: color 0.3s;
        -webkit-transition-property: color;
        -webkit-transition-duration: 0.3s;
        -webkit-transition-timing-function: initial;
        -moz-transition: color 0.3s;
        transition: color 0.3s;
        transition-property: color;
        transition-duration: 0.3s;
        transition-timing-function: initial;
        transition-delay: initial;
        display: inline-block !important;
        font-size: 0px;
        margin: 3px 30px 15px;
        width: 180px !important;
        height: 180px !important;
        border-radius: 50%;
        text-align: center;
        position: relative;
        z-index: 1;
        line-height: normal;
        vertical-align: baseline;
        background-image: none;
        background-position: 0% 0%;
        background-repeat: repeat;
        font-family: FontAwesome;
        font-weight: normal;
        font-style: normal;
        text-decoration: inherit;
        -webkit-font-smoothing: antialiased;
        background: #FAAC58;
    }