是否可以对齐反应片段?

发布于 2025-01-14 22:23:35 字数 297 浏览 3 评论 0原文

我有一个反应片段,它在用户单击按钮时显示加载程序。加载程序会显示直到响应到来。一切正常,除了具有加载程序的片段应该稍微向右对齐。到目前为止,我要显示的片段代码加载器(使用频谱等待)。

       <Fragment  >
        <Wait size="M" />
       Please wait....
      </Fragment>

如何将片段向右移动一段距离?我不能使用 div,因为它会扰乱布局。虽然我可以使用对齐属性对齐等待居中,但它不支持任何文本。

I am having a react fragment which shows loader on user clicking button.The loader is shown until response comes.Everything works fine ,except that the fragment which has loader, should be aligned to a little right.As of now my fragment code to show loader(Using Wait from spectrum).

       <Fragment  >
        <Wait size="M" />
       Please wait....
      </Fragment>

How can I move fragment to right by some distance? I cannot use div as it disturbs the layout.I can though align Wait to center by using align property but it does not support any text on that.

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

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

发布评论

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

评论(1

肤浅与狂妄 2025-01-21 22:23:35

片段不会在最终的 HTML 中呈现,因此无法通过 CSS 选择它们。因此,您应该使用可以对齐的东西,例如 div 或其他 HTML 元素,并使用 CSS 来创建您想要的布局。

如果使用 div 扰乱了您的布局,我建议尽可能修改包含对象的 CSS。

Fragments are not rendered in the final HTML so they cannot be selected by CSS. Therefore, you should use something which can be aligned, e.g. a div or other HTML element, and use CSS to create your desired layout.

If using a div disturbs your layout, I'd recommend revising the CSS of the containing object, if at all possible.

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