如何使用 HTML 和 CSS 创建浮雕边框?

发布于 2024-11-15 04:34:49 字数 144 浏览 3 评论 0原文

一些 GUI 使用带有浮雕边框的框来对小部件进行分组。

如何使用 HTML 和 CSS 创建这种外观?

浮雕边框会产生一种元素以 3D 形式从页面中伸出的错觉。它通常是通过使顶部和左侧边框变浅、底部和右侧边框变暗来创建的。

Some GUIs use boxes with embossed borders to group widgets.

How do I create this look with HTML and CSS?

An embossed border is one that creates the illusion that an element comes forward out of the page in 3D. It is often created by making the top and left border lighter and the bottom and right border darker.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

云之铃。 2024-11-22 04:34:50

有很多方法,特别是对于现代浏览器。

最简单的是明/暗边框(增加像素以获得更厚实的外观):

.box {
  border-top: #ccc 1px solid;
  border-right: #ccc 1px solid;
  border-bottom: #777 1px solid;
  border-left: #777 1px solid;
}

对于更复杂的东西,可以在盒子上使用背景图像。这提供了最佳的浏览器兼容性。 All-Expandable Box 有一个很好的演示。

使用 CSS3,您可以添加圆角、阴影和各种效果。

另外,如果您在小部件框中使用 jQuery 元素,那么 jQuery UI 包会附带一些漂亮的皮肤和简单的分组/盒子。

There's quite a few methods, especially with modern browsers.

The simplest is light/dark borders (increase pixels for a chunkier look):

.box {
  border-top: #ccc 1px solid;
  border-right: #ccc 1px solid;
  border-bottom: #777 1px solid;
  border-left: #777 1px solid;
}

For anything more complicated then background images can be used on the box. This provides the best browser compatibility. The All-Expandable Box has a good demo.

With CSS3 you can add rounded corners, drop shadows and all sorts of effects.

Also if you're using jQuery elements in widget boxes, then the jQuery UI packs come with some nice skins and easy grouping/boxes.

违心° 2024-11-22 04:34:50

您可能需要查看

标记。

定义和用法

该标签用于
将元素逻辑地组合在一起
表格。

标签在周围画了一个框
相关的表单元素。

该标签定义了标题
字段集元素。

You may want to have a look at the <fieldset> tag.

Definition and Usage

The tag is used to
logically group together elements in a
form.

The tag draws a box around
the related form elements.

The tag defines a caption for
the fieldset element.

梦中的蝴蝶 2024-11-22 04:34:50

除 " 之外的各种 border-style 值之一实线”、“点线”和“虚线”可能会给你你想要的。

One of the various border-style value other than "solid", "dotted" and "dashed" will probably give you what you want.

世界如花海般美丽 2024-11-22 04:34:49

我看到的大多数 GUI 都使用类似于 CSS 的 border-style:groove 的组框样式。

如果您需要对 HTML 表单使用组框,请使用

作为组标签。

Most GUIs I see use a style similar to CSS's border-style: groove for group boxes.

If you need to use a group box for your HTML forms, use <fieldset> with <legend> for the group label.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文