【问题标题】:How to make text appear at the top left corner?如何让文字出现在左上角?
【发布时间】:2015-09-21 14:42:42
【问题描述】:

这是我正在尝试实现的 UI 原型

这是我目前拥有的 JSFiddle 以及我尝试过的 CSS

.help_header {
     transform: translateY(-100px); 
    padding-bottom: 30px;
    margin-bottom: 30px;
 }

有谁知道如何使文本显示在顶部,而不是底部?

我尝试了padding-bottom,这对我来说最有意义(div 底部边框和文本之间的距离),但没有奏效。我也试过margin-bottomtransform:translateY 但这些属性也不起作用。

【问题讨论】:

  • 垂直对齐:顶部;应该做的伎俩
  • @MathijsRutgers 谢谢,这应该是答案!
  • 你说它有效是因为,我认为在其他地方将跨度设置为display:inline-block,否则它不会这样做demo here
  • @Pangloss 从未使用过 display:inline-block。
  • 或将其设置为浮动或任何使其不作为内联元素的东西,无论如何你已经让它工作了,仅此而已。

标签: html css user-interface user-experience


【解决方案1】:

html:

<body>
  <div id="header">
    <img  src="http://imgur.com/x45xmG3.jpg" />
   <div class="help_header">
    <span>Contact us</span>
    <span>Forum</span>
   </div>
</div>
</body>

css:

body {
padding:0;
margin:0;
}
#header {
height: 100px;
float:left;
}

.help_header {
float:right;
}

您是否正在寻找这样的 somting:JSFiddle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多