1e41f4b71Sopenharmony_ci# Adding an Image
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciGenerally, the **[\<image>](../reference/apis-arkui/arkui-js/js-components-basic-image.md)** component is used to add images on a page. The method of using this component is similar to that of using the **\<text>** component.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciTo reference images via the **\<image>** component, you are advised to store the image files under **js\default\common**. (You need to create the **common** directory on your own.) For details about the directory structure, see [Directory Structure](../ui/js-framework-file.md#directory-structure). The following sample code shows you how to add an image and set its style.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci```html
11e41f4b71Sopenharmony_ci<!-- xxx.hml -->
12e41f4b71Sopenharmony_ci<image class="img" src="{{middleImage}}"></image>
13e41f4b71Sopenharmony_ci```
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci```css
17e41f4b71Sopenharmony_ci/* xxx.css */
18e41f4b71Sopenharmony_ci.img {  
19e41f4b71Sopenharmony_ci  margin-top: 30px;
20e41f4b71Sopenharmony_ci  margin-bottom: 30px;
21e41f4b71Sopenharmony_ci  height: 385px;
22e41f4b71Sopenharmony_ci}
23e41f4b71Sopenharmony_ci```
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci```js
27e41f4b71Sopenharmony_ci// xxx.js
28e41f4b71Sopenharmony_ciexport default {
29e41f4b71Sopenharmony_ci  data: {
30e41f4b71Sopenharmony_ci    middleImage: '/common/ice.png',
31e41f4b71Sopenharmony_ci  },
32e41f4b71Sopenharmony_ci}
33e41f4b71Sopenharmony_ci```
34