div中的水平对齐链接具有table-cell属性

时间:2016-03-13 23:51:13

标签: javascript html css

如何将div中的文本与" next"上课到右边? 我的HTML代码:

g++ 4.9.2

和css:

<div class="box">
  <div class="navigation prev">
    <a>prev</a>
  </div>
  <div class="rec"><a href="">rec</a></div>
  <div class="navigation next">
    <a>next</a>
  </div>
</div>

jsFiddle链接:http://jsfiddle.net/zhe6ctkm/

2 个答案:

答案 0 :(得分:1)

您的标题和问题似乎不匹配,所以我将回答您的问题。您可以使用text-align: right;将链接对齐到右侧。

.box {
  display: table;
  margin-right: auto;
  margin-left: auto;
  width: 100%;
}
.rec {
  display: table-cell;
  padding: 10px;
  text-align: center;
  background: red;
}
.navigation {
  display: table-cell;
  background: yellow;
}
.navigation.next {
  text-align: right;
}
<div class="box">
  <div class="navigation prev">
    <a>prev</a>
  </div>
  <div class="rec"><a href="">rec</a>
  </div>
  <div class="navigation next">
    <a>next</a>
  </div>
</div>

答案 1 :(得分:1)

只需添加:

const ToastTemplateType toastTemplate = ToastTemplateType.ToastImageAndText01;
var toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);

var toastTextElements = toastXml.GetElementsByTagName("text");
toastTextElements[0].AppendChild(toastXml.CreateTextNode("Hello World!"));

var toastImageAttributes = toastXml.GetElementsByTagName("image");
((XmlElement)toastImageAttributes[0]).SetAttribute("src", "https://i.stack.imgur.com/wzdIt.jpg");

var toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);