> For the complete documentation index, see [llms.txt](https://docs.h5ui.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.h5ui.io/base.md).

# 基础样式

## 目录结构

`dist/` 为生产环境目录，包含 CSS、JavaScript、图片素材 和 用于演示的 HTML 文件。

`src/` 存放 Less、JavaScrip 文件源码 和 Sketch 文件。

```
h5ui/
├── dist/
│   ├── css/
│   ├── example/
│   ├── img/
│   └── js/
├── src/
│   ├── js/
│   ├── less/
│   └── sketch/
├── package.json
├── gulpfile.js
└── server.js
```

## 文件引用

**基础 CSS 引用**

```html
<!-- H5UI CSS -->
<link rel="stylesheet" href="https://h5ui.io/css/h5ui.min.css">
```

**基础 JS 引用**

```html
<!-- jQuery -->
<script src="https://h5ui.io/js/jquery.min.js"></script>

<!-- H5UI JS -->
<script src="https://h5ui.io/js/h5ui.min.js"></script>
```

## 基本 HTML 模版

```html
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no" />

    <title>H5UI</title>

    <!-- H5UI CSS -->
    <link rel="stylesheet" href="https://h5ui.io/css/h5ui.min.css">

</head>
    <body ontouchstart>

        <!-- start [Module] -->
        <h1>Hello, H5UI!</h1>
        <!-- end [Module] -->

        <!-- jQuery -->
        <script src="https://h5ui.io/js/jquery.min.js"></script>
        <!-- H5UI JS -->
        <script src="https://h5ui.io/js/h5ui.min.js"></script>
    </body>
</html>
```

## base.less

**variable.less**

```less
// Colors
@colorPrimary: #43AC43;
@colorPrimaryDark: darken(@colorPrimary, 5%);
@colorPrimaryDarker: darken(@colorPrimary, 10%);

@colorRed: #EC5055;
@colorRedDark: darken(@colorRed, 5%);
@colorRedDarker: darken(@colorRed, 10%);

@colorBlack: #000;
@colorGrayDarker: #222;
@colorGrayDark: #666;
@colorGray: #999;
@colorGrayLight: #CCC;
@colorLine: #E5E5E5;
@colorWhite: #FFF;

@backgroundPrimary: #F5F6F7;

// Font family
@fontFamilyPrimary: -apple-system-font, "Helvetica Neue", sans-serif;
```

**reset.less**

```less
*,
*:before,
*:after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

html,
body{
  position: relative;
  height: 100%;
  width: 100%;
}

html {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-tap-highlight-color: transparent;
}

body {
  background: @backgroundPrimary;
  font-family: @fontFamilyPrimary;
  color: @colorGrayDarker;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.41176471;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  position: relative;
  text-align: left;
}

a {
  color: @colorGrayDarker;
  text-decoration: none;
}

a,
input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  outline: 0;
}

textarea{
  resize: none;
  vertical-align: middle;
}

img {
  border: 0;
}

small {
  font-size: 80%;
}

// Clearfix
.clearfix:before,
.clearfix:after {
  content: "";
  display: table;
}
.clearfix:after {
  clear: both;
}

// Disabled
.disabled, [disabled] {
  opacity: 0.55;
  pointer-events: none;
}

// Float
.pull-left {
  float: left !important;
}

.pull-right {
  float: right !important;
}

// Text Align
.text-center{
  text-align: center !important;
}
.text-left{
  text-align: left !important;
}
.text-right{
  text-align: right !important;
}

// Page
.h5ui-page{
  &.top{
    padding-top: 15px;
  }
  &.bottom{
    padding-bottom: 15px;
  }
  &.spacing{
    padding: 0 15px;
  }
  &.spacing-cell{
    padding: 15px;
  }
}

```

### 1px 细线 Mixin

```less
.module{
  position: relative;
}

<!-- 下边线 -->
.module:before {
    .mixin-hairline_bottom;
}

<!-- 上边线 -->
.module:after {
    .mixin-hairline_top;
}

<!-- 四边线 -->
.module:before {
    .mixin-hairline_full;
}

<!-- 左边线 -->
.module:before {
    .mixin-hairline_left;
}

<!-- 右边线 -->
.module:after {
    .mixin-hairline_right;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.h5ui.io/base.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
