Title: Problem with CSS
Last modified: August 21, 2016

---

# Problem with CSS

 *  Resolved [muradbougrain](https://wordpress.org/support/users/muradbougrain/)
 * (@muradbougrain)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/problem-with-css-12/)
 * Hi, i add the widget to my WordPress Theme, but it don’t take the styling of 
   the css file, i don’t know why?
    i use this code in **_function.php page_** :
 *     ```
       if(function_exists('register_sidebar'))
       register_sidebar(array('name' => 'sidbar',
                   'before_widget' => '<div>',
                   'after_widget' => '</div>',
                   'before_title' => '<h1>',
                   'after_title' => '</h1>'
       ));
       ```
   
 * and this in **_sidebar.php page_** :
 *     ```
       <?php if ( !function_exists('dynamic_sidebar')
        || !dynamic_sidebar(sidbar) ): ?>
       <?php endif; // end primary widget area ?>
       </div>
       ```
   
 *  , but the final result give me a widget without css style,?!!.
    please: could
   any one here help me?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/problem-with-css-12/#post-5079260)
 * What’s probably happening is that your function creates widgets with HTML tags,
   but no HTML classes, which might prevent your widget’s CSS rules from being applied
   to them, but it would help if you could post a link to your website. Also, is“
   sidbar” a typo?
 *  Thread Starter [muradbougrain](https://wordpress.org/support/users/muradbougrain/)
 * (@muradbougrain)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/problem-with-css-12/#post-5079268)
 * **_P.S : sidbar it’s the ID name of the sidebar 🙂_**
    you’re right i just add
   the name of ID ‘ sidbar’ and didn’t add the name of the classes, my theme right
   new is just in my localhost I’m waiting until finishing the work & upload it 
   to my Host, but i take a screenshot and it’s here : [here on imgur](http://imgur.com/roww2Sy)
   as i said you’re right i just added the ID but i didn’t added the classes, now
   the answer How i do to add classess 🙂 and thank you so much another **P.S**:
   I’m not English Native speaker
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/problem-with-css-12/#post-5079300)
 * You can control the HTML used to output your widgets using `before_widget`, `
   after_widget`, `before_title`, and `after_title`. If you call `register_sidebar()`
   like this:
 *     ```
       register_sidebar( array(
           'name' => 'sidbar',
           'before_widget' => '<div class="widget">',
           'after_widget' => '</div>',
           'before_title' => '<h1 class="widget-title">',
           'after_title' => '</h1>'
       ) );
       ```
   
 * Then each widget would be wrapped in a `<div>` with the class “widget”, and the
   title of each widget would be wrapped in an `<h1>` with the class “widget-title”.
   You could then target the widget using CSS like this:
 *     ```
       .widget {
           ... CSS code ...
       }
   
       .widget .widget-title {
           ... CSS code ...
       }
       ```
   
 * You might consider checking out any one of the many CSS tutorials out there.
 *  Thread Starter [muradbougrain](https://wordpress.org/support/users/muradbougrain/)
 * (@muradbougrain)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/problem-with-css-12/#post-5079306)
 * Thank you so much you help me to solved this problem Thank you again,
    I was 
   wondering if i can add more than one class in a div but today i learned that 
   i can add more and how to do that :), i use :
 *     ```
       if(function_exists('register_sidebar'))
       register_sidebar(array('name' => 'sidbar',
                   'before_widget' => '<div class=" block_cat block_arc ">',
                   'after_widget' => '</div>',
                   'before_title' => '<h1 class=" block_cat block_arc ">',
                   'after_title' => '</h1>'
       ));
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem with CSS’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [muradbougrain](https://wordpress.org/support/users/muradbougrain/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/problem-with-css-12/#post-5079306)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
