【问题标题】:Multiple blocks inside another?另一个里面有多个块?
【发布时间】:2013-03-12 00:03:45
【问题描述】:

我试图将我的名字放在另一个包含网站名称的块中,但无法弄清楚。我可以使用什么?

我正在尝试在我的网站名称之后加上一个较小的扩展名,这很有效。但是我想在它下面没有我的名字。

<div id="sitename">
  <span id="address">website</span>
  <span id="extension">.blah</span>
  <span id="name">namegoeshere</span>
</div>

#sitename {
  width: 330px;
  margin: 35px auto 0 auto;
  text-align: center;
  cursor: default;
}

#address {
  display: inline-block;
  height: 65px;
  font-size: 50pt;
  font-weight: 800;
  color: rgb(99,99,99);
}

#extension {
  display: inline-block;
  height: 65px;
  font-size: 30pt;
  font-weight: 800;
  color: rgb(99,99,99)
}

#name {
  display: block;
  width: 72%; 
  text-align: right;
  font-size: 11.5pt;
  font-weight: 500;
  color: rgb(99,99,99);
}

小提琴:http://jsfiddle.net/CX5Dn/

【问题讨论】:

  • How2Margins。说真的。

标签: html css


【解决方案1】:

这是你想要达到的目标吗

html

<div id="sitename">
  <span id="address">website<span id="extension">.blah</span></span>
  <span id="name">namegoeshere</span>
</div>

css

#sitename {
  width: 330px;
  margin: 35px auto 0 auto;
  text-align: center;
  cursor: default;
}

#address {
  display: inline-block;
  height: 65px;
  font-size: 50pt;
  font-weight: 800;
  color: rgb(99,99,99);
}

#extension {
  display: inline-block;
  height: 65px;
  font-size: 30pt;
  font-weight: 800;
  color: rgb(99,99,99)
}

#name {
  display: block;
  width: 72%; 
  text-align: right;
  font-size: 11.5pt;
  font-weight: 500;
  color: rgb(99,99,99);
}

工作demo

【讨论】:

    【解决方案2】:

    名称的边距。

    #name {
    display: block;
    width: 72%; 
    text-align: right;
    font-size: 11.5pt;
    font-weight: 500;
    color: rgb(99,99,99);
    margin-top: -20px;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-12
      • 1970-01-01
      • 1970-01-01
      • 2022-10-08
      • 2015-06-24
      • 2015-03-10
      • 2014-03-04
      相关资源
      最近更新 更多