css - 来自 Android XML 布局,如何将网页元素放置在 XHTML 中?

标签 css xhtml

我主要是一名 Android 开发人员,但我对使用 CSS 创建 XHTML 网页样式非常感兴趣。我想制作一个简单的网页布局,由三行组成,中间一行有三列。在 Android XML 中,我会这样(大致)完成:

<LinearLayout orientation:vertical> (parent)
----<LinearLayout orientation: horizontal>
----<LinearLayout orientation: horizontal>
--------<LinearLayout orientation: vertical>
--------<LinearLayout orientation: vertical>
--------<LinearLayout orientation: vertical>
----<LinearLayout orientation: horizontal>

这会创建一个看起来像这样的布局:

-----------------------------------------------
|                                             |
-----------------------------------------------
|             |                   |           |
-----------------------------------------------
|                                             |
-----------------------------------------------

我对 XHTML 和 CSS 还是有点陌生​​(虽然我的基础知识不多),虽然我学得很快,但我还没有找到任何针对 Android 开发人员的网页布局设计教程.如果有人能解释一种实现我想要的布局的好方法,我将不胜感激。

TLDR:如何使用 XHTML 和/或 CSS 制作由三行组成、中间行具有三列的网站布局?

非常感谢!

最佳答案

这可能是您应该通过教程学习的内容,但这是您所要求的近似值。 http://jsfiddle.net/7LYhu/

HTML

<div class="row"> Row
</div>

<div class="row">
  <div class="col">
  Column
    </div>
  <div class="col">
      Column
  </div>
  <div class="col">
      Column
  </div>
</div>

<div class="row">
    Row
</div>​

CSS

.row {
      width: 80%;
      background: gray;
      text-align: center;
    }
.col {
      width: 33.3%;
      float: left;
      background: orange;
}​

关于css - 来自 Android XML 布局,如何将网页元素放置在 XHTML 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13870625/

相关文章:

html - 表格单元格在浏览器调整大小时调整大小

css - Bootstrap 4 - 折叠不起作用

javascript - CSS 和 JS 文件未加载,MAMP 服务器

html - FF 中格式不正确的错误消息

css - IE6/7 链接重叠+文本缩进

c# - 如何解析不是 100% 有效的 XHTML 文件?

html - 在 <li> 中选择菜单适用于 ios chrome 但不适用于 ios safari

html - 如何对齐我的 adsense 图片?

php - 使用 PHP DOMDocument 区分 XHTML 和 HTML

xml - 3 路 XML 合并算法