简体   繁体   English

将div元素向右对齐

[英]Align div elements to the right

I'm trying to align the elements inside a Facebook Like / Share div to the right but none of the methods I'm finding works. 我正在尝试将Facebook Like / Share div的元素向右对齐,但找不到任何一种有效的方法。 Here's a screenshot: 这是屏幕截图:

这不是我想要的。

What I'd like is for everything to be aligned to the right. 我想要的是使所有内容都向右对齐。 Basically I tried everything but nothing works. 基本上我尝试了一切,但没有任何效果。 This is the div code: 这是div代码:

<div style='background-color: #b0c4de;'
   class="fb-like"
   data-share="true"
   data-width="15"
   data-show-faces="true">
</div>

What am I missing? 我想念什么?

EDIT: This is hardly a solution but it's a hack I can live with for now. 编辑:这几乎不是解决方案,但现在是我可以接受的黑客。 It's pushing the entire div - not the elements which is what I really need - to a place that sort of aligns correctly in the context of the page. 它会将整个div(而不是我真正需要的元素)推到在页面上下文中正确对齐的位置。

<div style='position:relative; right:-50px;'... 
<div style="float: right;">Right Div</div>
<div style="text-align: right;">Share</div>

Use the HTML align Attribute: 使用HTML align属性:

Syntax <div align="left|right|center|justify"> 语法<div align="left|right|center|justify">

enter link description here Attribute Values 在此处输入链接描述属性值

  • Value Description 值说明
    • left=align content left left =左对齐内容
    • right-align content right 右对齐内容
    • center=-align content to Center center =将内容对齐中心
    • justify=Stretches the lines so that each line has equal width (like in newspapers and magazines) justify =拉伸线,以使每条线具有相等的宽度(例如在报纸和杂志上)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM