Title: Missing closing DIV tag when adding custom CSS class could break layout
Last modified: November 21, 2017

---

# Missing closing DIV tag when adding custom CSS class could break layout

 *  [Pat](https://wordpress.org/support/users/fortythousandmiles/)
 * (@fortythousandmiles)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/missing-tag-when-adding-custom-css-class-could-break-layout/)
 * I have encountered a problem which could break the pages layout with a missing
   </div> tag which should be closing the
 * `<div class="ShariffSC (...)`
 * when adding a custom CSS class in the Shariff options.
 * I think it is down to the fact that for the opening tag it is checking for
 * `array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts )`
 * but for the closing tag it is only checking
 * `array_key_exists( 'style', $atts )`
 * so if you have added a custom class but no custom styles, the div is not closed.
 * **Possible solution (?)**
    I don’t know if I’m correct on this one, but changing
 *     ```
       // if we had a style attribute close that too
       if ( array_key_exists( 'style', $atts ) ) $output .= '</div>';
       ```
   
 * in line _910/911_ to
 *     ```
       // if we had a style attribute close that too
       if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) $output .= '</div>';
       ```
   
 * solved the problem for me.

The topic ‘Missing closing DIV tag when adding custom CSS class could break layout’
is closed to new replies.

 * ![](https://ps.w.org/shariff/assets/icon.svg?rev=2006307)
 * [Shariff Wrapper](https://wordpress.org/plugins/shariff/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shariff/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shariff/)
 * [Active Topics](https://wordpress.org/support/plugin/shariff/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shariff/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shariff/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Pat](https://wordpress.org/support/users/fortythousandmiles/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/missing-tag-when-adding-custom-css-class-could-break-layout/)
 * Status: not resolved