像<center>一样,如何使用css将html中的多行文本居中?

腰带

我有这个html内容:

<div class="test">
  <a href=/cgi-bin/source/sourceSearch><img border=0 src=http://source-search.princeton.edu/images/SOURCE/sourcehdrBlue.gif></a>
  <h2 style='margin-bottom:0px'>BATCH</h2>
  <table border="0" cellpadding="0" width="600">
    <tr>
      <td><h3>SOURCE is now hosted by Princeton University. The supporting database was last updated on June 10, 2015. </h3> <p>This page is the batch extract interface for SOURCE.  You can input a list of GenBank Accessions, dbEST cloneIDs, UniGene ClusterIDs, UniGene gene names, UniGene gene symbols microarray Probes from various platforms (Affymetrix, Agilent, Heebo/meebo, Illumina) or coordinates (e.g.: chr1 14565 15000 - chromosome, from, to - one set per line) and retrieve data from the checklist below.  You will be given a link to the output file when processing is complete.</p> <p>You may enter the identifiers as a file or as a list in the text area below.  If you are entering an input file, it must be a text file consisting of a single column containing one of the accepted types of identifiers.</p> <p>Please see the <a href="http://source-search.princeton.edu/help/SOURCE/resultsBatchHelp.html">help</a> section for further information. Or go to <a href="http://source-search.princeton.edu/cgi-bin/source/sourceSearch">Single Entry SOURCE Search.</a> </p></td>
    </tr>
  </table>
</div>

只需添加<center>... </center>所有这些代码,这就是我想要的。在此处输入图片说明由于<center>标记已在HTML中弃用,因此我想使用CSS而不是<center>我的CSS代码是这样的:

div.test {
margin-left: auto;
margin-right: auto;
text-align: center;

}

我懂了: 在此处输入图片说明

我尽了我所能找到的一切,但所有这些都不对我有用。我使用Windows 7和chrome,我已经看到为什么HTML中不推荐使用<center>标记?Simple可以使一个没有CSS且没有CSS的对象居中

汤米

您使用它是有原因的<table>吗?

改变你的CSS:

    div.test {
text-align: center;
}

div table{
  margin: 0 auto;
}

小提琴

单击此处获取您的代码

这会回答你为什么这里<center>不赞成回答

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

像toggleclass一样使用.css

来自分类Dev

像toggleclass一样使用.css

来自分类Dev

在我的文本中像变量一样使用sharedPreferences

来自分类Dev

如何像Microsoft Word一样在CSS中拉伸文本?

来自分类Dev

Apple Game Center的测试播放器是否像真实用户一样完成?

来自分类Dev

如何像普通 HTML 一样在 jsx“标签”中呈现文本?

来自分类Dev

是否可以像CSS一样将字体文件嵌入到html中?

来自分类常见问题

如何像使用Sublime Text一样围绕PyCharm中的选定文本

来自分类Dev

如何使用CSS将框像海报板一样放置?

来自分类Dev

如何使Emacs文本像Netbeans一样清晰呈现

来自分类Dev

如何使Emacs文本像Netbeans一样清晰呈现

来自分类Dev

如何读取像文本一样的excel(.xls)文件?

来自分类Dev

像CSS Transitions一样下雨

来自分类Dev

如何制作像CSS过渡一样的过渡效果?

来自分类Dev

像CSS3中的Photoshop一样的Photoshop

来自分类Dev

像总结一样使用崩溃

来自分类Dev

使用像按钮一样的图像

来自分类Dev

像scp一样使用sftp

来自分类Dev

像 UISwitch 一样使用 UISegmentedControl

来自分类Dev

像背包一样

来自分类Dev

如何像战舰游戏一样读取HTML表格?

来自分类Dev

像HTML中的列一样垂直包装

来自分类Dev

使用textView在iOS应用程序中像字幕样式一样将文本从底部移动到顶部

来自分类Dev

如何像使用接口一样使用枚举?

来自分类Dev

如何像使用接口一样使用枚举?

来自分类Dev

如何将文本文件转换为像报纸一样的列?

来自分类Dev

如何使UITextField像Swift中的UISearchBar一样工作?

来自分类Dev

如何像javaScript中的函数一样执行String?

来自分类Dev

如何在iOS中给像卡一样的阴影

Related 相关文章

热门标签

归档