简体   繁体   English

HTML / CSS 自定义 PayPal Wordpress 页面上的按钮

[英]HTML / CSS Customization for PayPal Button on Wordpress Page

For my Checkout page I am trying to align the paypal "quick check-out" button to the left.对于我的结帐页面,我试图将 paypal“快速结帐”按钮对齐到左侧。 With Firebug I found the CSS part that is yet set to center.使用 Firebug,我发现 CSS 部分尚未设置为中心。 If I type in "left" it does move to the left.如果我输入“left”,它确实会向左移动。 So I copied the rule to my custom css field in Wordpress因此,我将规则复制到了 Wordpress 中的自定义 css 字段

#zoid-paypal-button-1a79a61bc2.paypal-button-size-responsive {
text-align: left;}

That first bit isn't static though which is probably why it is centered again after refreshing the page.第一位不是 static 虽然这可能是刷新页面后它再次居中的原因。 How can I make it permanent?我怎样才能让它永久化?

它看起来如何

Use one of the classes for the relevant element, rather than the dynamically-generated button ID, such as:使用相关元素的类之一,而不是动态生成的按钮 ID,例如:

.paypal-button-size-responsive {
  text-align: left;
}

The problem is that there's an inline selector with greater specificity in the folded <style> element in your screenshot.问题是屏幕截图中折叠的<style>元素中有一个更具体的内联选择器。 #zoid-paypal-button-1a79a61bc2.paypal-button-size-responsive will always override .paypal-button-size-responsive . #zoid-paypal-button-1a79a61bc2.paypal-button-size-responsive将始终覆盖.paypal-button-size-responsive You need to look at the plugin that generates your checkout page and see where those styles are inlined and remove it there.您需要查看生成结帐页面的插件,并查看这些 styles 的内联位置并将其删除。

Alternatively, and this isn't really recommended, you could use the !important rule to overrule the more specific ID selector if you're having trouble tracking it down, ie text-align: left;important;或者,这并不是真正推荐的,如果您在跟踪它时遇到问题,您可以使用!important规则来否决更具体的 ID 选择器,即text-align: left;important; . . That's a bad habit to pick up, however, as it makes maintaining your CSS more difficult in the long run.然而,这是一个不好的习惯,因为从长远来看,这会使维护您的 CSS 变得更加困难。

If you can comment or edit your question to include what plugin you're using that generates the code in question, I'll see if I can give you more specifics on where you can find the <style> element in question.如果您可以评论或编辑您的问题以包含您正在使用的生成相关代码的插件,我会看看是否可以为您提供更多关于在哪里可以找到相关<style>元素的细节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM