Is it possible to use css to edit buttons created with shortcode in wordpress?

I have a button on one of my pages in wordpress and I want to float it to the right because right now it is floated left.

Can I do that with css since its created using shortcode? If so, what would I edit?

Related posts

Leave a Reply

1 comment

  1. Shortcode is just a shortcut for outputting normal, pre-formatted HTML. You can write a CSS rule to style the element(s) but it depends on the markup the shortcode is generating:

    1. Output the shortcode and view the page in a browser.
    2. Inspect with Firebug or Chrome Dev Tools (for example) or CTRL+U.
    3. Look for ids or class names on or above the generated elements.
    4. Write a CSS rule that targets the elements using info from #3. You could add this rule in the style.css file in your theme folder.

    It’s possible that your rule will be overridden by another style; shortcode providers often “sandbox” CSS with inline styling, so that a user’s other styles don’t interfere with their elements. The quickest solution is to add the !important override to your rule, e.g.:

    #target {
        float: right !important;
    }
    

    This overrides future inline styling on the element.