html - 不允许单击元素的边距来更改页面
问题描述
目前我在锚元素中有一个标题元素,但是我正在使用规则margin: 0 auto
使标题居中,这会在每一侧留下 232px 的边距,如果单击它将更改页面。如何在不留下单击时会更改页面的边距的情况下使此标题居中?谢谢,如果需要,我可以添加任何其他屏幕截图
代码:
a(href=`${story.url}`)
h5.disabled.balance-text(style="width:466px;margin:0 auto;") #{story.title}
br
img(src=`${story.storyImageUrl}` style="width:400px;")
br
br
p.balance-text(style="width:440px;margin: 0 auto;color:black") #{story.description} (#{timeAgo.format(new Date(story.publishedAt))})
解决方案
将元素包装在容器中,并在包含的项目仍与单击处理程序绑定时对其应用边距和宽度
推荐阅读
- javascript - 使用 jquery 中的 setInterval 根据下拉选择值自动更新
- reactjs - 如何从 Formik 中的 material-ui-phone-number 提交 MuiPhoneNumber
- php - 减去两次
- debugging - Visual Studio Community 2019 在调试时保存 HTML 和 CSS 文件
- swift - 如何设置屏幕色调颜色 Cocoa mac app
- git - 设置 github 存储库
- regex - REGEXP:在一行中第一次出现数字之前添加一个字符
- c++ - libxerces-c.so:对许多包的未定义引用
- assembly - 未对齐的负载。加载到 R1 中的字的地址是什么?
- javascript - 打字稿语法:用 < > 调用函数