doujuyang1764 2011-06-15 14:58
浏览 171
已采纳

HTML / CSS问题:div的一部分浮动到下一行,我希望它在同一行

I am loading names/grades from a database which happens perfectly... however, the grade assosciated with the person is for some reason getting floated down to the next line and I can't figure out why, as you can see in this picture: http://i.stack.imgur.com/rqhjp.png

I want that number grade to be on the same line, aligned on the right, but I cant figure out why it's getting pushed down to the next line. Here is my php:

echo '<div class = "name">' . $firstname . " "  . $lastname . "<strong>" . '<p align="right">' . $avg . '</p></strong></div>';

And the CSS it refers to:

}

#content .name{
    background: #FFF;
    float:left; 
    width: 220px;
    padding: 0px;
    position: relative;
    margin: 0px;
    font-size: 1.4em;
    border: 2px solid #CCC;
    border-radius: 10px;
}
  • 写回答

3条回答 默认 最新

  • doufendi9063 2011-06-15 15:02
    关注

    Instead of using p and align, put the grade in a span and float it to the right. You can see it working in this fiddle.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记