Hello, World!
This is a background UI design challenge.
在 HTML 和 CSS 中实现一个带有背景图片的 UI 设计
HTML 代码示例:
Hello, World!
This is a background UI design challenge.
CSS 代码示例:
body {
margin: 0;
padding: 0;
font-family: 'Helvetica Neue', sans-serif;
}
.container {
width: 100%;
height: 100%;
background-image: url('background-image.jpg');
background-repeat: no-repeat;
background-size: cover;
}
.content {
max-width: 800px;
margin: 0 auto;
padding: 100px 20px;
text-align: center;
color: white;
text-shadow: 1px 1px rgba(0,0,0,0.3);
}
其中,.container
元素包含背景图片,.content
元素则是背景图片上的内容。这个 UI 设计也受益于在.content
中使用 max-width
和 margin: 0 auto
,这些属性使得内容在比较大的屏幕上也能够很好地居中对齐。最后,color
和 text-shadow
属性用于改变文字显示和添加阴影。
上述代码是为了演示这个 UI 设计挑战的一个基本示例,可以根据具体情况进行调整和优化。
上一篇:背景图中心显示Logo