WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom header widget size problem... (3 posts)

  1. Sandra408
    Member
    Posted 2 years ago #

    Hi.
    I added a widget for my header. But it stretches all the way across the top, so does not react to it's size dimensions or a z-index position... Have no idea what I did wrong.

    Here is the functions.php file code:

    register_sidebar( array(
        'name' => __( 'Header Widget Area Left', 'My-Theme-Name' ),
        'id' => 'header-widget-area-left',
        'description' => __( 'The header left widget area', 'my-theme-name' ),
        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
    ) );

    Here is what I put in the header:

    <?php
    
    if ( is_active_sidebar( 'header-widget-area-left' )) {
    
    dynamic_sidebar( 'header-widget-area-left' );
    }
    ?>

    And here is CSS:

    #header-widget-area-left {
        float: left;
        position: absolute;
        width: 150px;
        height: 233px;
        z-index: 50;
    }

    Any ideas?

    Thanks.

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    My-Theme-Name v. my-theme-name ?

  3. Sandra408
    Member
    Posted 2 years ago #

    I resolved it by putting php code in <div> tags and giving <div> an id ...

    Here is CSS:

    #header-left-widget-holder {
        height: 233px;
        width: 150px;
        margin: 23px 0 40px 40px;
        position: absolute;
        z-index: 50;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic