aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/inline-size/index.html
blob: c0b216abc9e551e8023e33ee566968e3ddc2b66d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
title: inline-size
slug: Web/CSS/inline-size
translation_of: Web/CSS/inline-size
---
<div>{{CSSRef}}</div>



<p><strong><code>inline-size</code></strong> <a href="/en-US/docs/Web/CSS" title="CSS">CSS</a> 属性影响一个元素的{{cssxref("width")}}{{cssxref("height")}},以改变一个元素的盒模型的水平或垂直大小(是width还是height取决于该元素的{{cssxref("writing-mode")}})。</p>

<div>{{EmbedInteractiveExample("pages/css/inline-size.html")}}</div>



<h2 id="语法">语法</h2>

<pre class="brush:css no-line-numbers">/* &lt;length&gt; values */
inline-size: 300px;
inline-size: 25em;

/* &lt;percentage&gt; values */
inline-size: 75%;

/* Keyword values */
inline-size: max-content;
inline-size: min-content;
inline-size: fit-content(20em);
inline-size: auto;

/* Global values */
inline-size: inherit;
inline-size: initial;
inline-size: unset;
</pre>



<p>如果元素的writing-mode是垂直方向的它会影响height,否则默认是影响width。</p>

<p>有一个与inline-size 属性有关的{{cssxref("block-size")}},它定义了元素的其他尺寸。</p>

<p>{{cssinfo}}</p>

<h3 id="值"></h3>

<p><code>inline-size</code>属性的可选值与{{cssxref("width")}}{{cssxref("height")}}的可选值一样。</p>

<h3 id="正式语法">正式语法</h3>

{{csssyntax}}

<h2 id="示例">示例</h2>

<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;p class="exampleText"&gt;Example text&lt;/p&gt;
</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css">.exampleText {
  writing-mode: vertical-rl;
  background-color: yellow;
  inline-size: 110px;
}</pre>

<p>{{EmbedLiveSample("Example")}}</p>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName("CSS Logical Properties", "#propdef-inline-size", "inline-size")}}</td>
   <td>{{Spec2("CSS Logical Properties")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("css.properties.inline-size")}}</p>

<h2 id="参阅">参阅</h2>

<ul>
 <li>The mapped physical properties: {{cssxref("width")}} and {{cssxref("height")}}</li>
 <li>{{cssxref("writing-mode")}}</li>
</ul>