css - 在处于事件状态时更改按钮的外观

标签 css reactjs typescript

我需要帮助来更改一个按钮,使其看起来像一个箭头从中伸出,以表明它是事件按钮。该按钮包裹在卡片组件中。

下面是一个代码示例:

        <div className="float-container">
          <div className="creator-container float-child">
            <div>
              <Card className="bg-mainBlue rounded-xl">
                <CardContent>
                  <Button
                    className=" text-white font-nunito text mx-2 pr-35 "
                    onClick={() => onFieldAdd('textField')}
                  >
                    <TextFieldsIcon />
                    <p>&nbsp;&nbsp;&nbsp;Text Box</p>
                  </Button>
               </div>
              </div>
             </div>

我正在努力改变按钮的外观。我的代码是使用 TypeScript 在 React 中构建的。我想主要使用 css 来实现这一点。

我附上了一张我想要的结果的图片。

enter image description here

有人可以帮忙吗?

enter image description here

最佳答案

所以你可以制作 ::before 元素。将其设置为 display:block,然后将其添加到 backround:_mainBlue_transform:rotate(45deg)。不要忘记 content:''。然后只是玩这个位置。

例子: https://codepen.io/daniel-bedn-/pen/zYWbeeP

关于css - 在处于事件状态时更改按钮的外观,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73453305/

相关文章:

javascript - Express 中来自 React 子组件的 POST 请求

typescript tsconfig.json 包括排除不工作

仅适用于 Opera Mini 的 CSS

javascript - 如何创建一个自动滚动列表

html - 覆盖图像时出现问题

reactjs - 未找到模块 : Can't resolve 'react-table/react-table.css'

javascript - 使用 Javascript 单击更改 CSS 类?

javascript - Redux 中间件和接受所有操作的 reducer 之间的区别

node.js - 动态匹配变量 Mongodb

javascript - MongoDB 按 (id1, id2) 或 (id2,id1) 分组