• first sorry for my english. is there any way to calling class in a class on css? let say i’ve four class, two class handle the box to get rounded corner and i name it as border3 where its give’em 3px rounded and border5 where its give’em 5px rounded and than other two class is header and content, can i call border3 class or border5 in header or content class? or it can’t? its more like call a function php in function. is anyone can help me figure this out? thanks before..

Viewing 6 replies - 1 through 6 (of 6 total)
  • is there any way to calling class in a class on css?

    .header.border3 {
    [...]
    }
    .header.border5 {
    [...]
    }

    Learning CSS

    Thread Starter Rahendra Putra K?

    (@rahendz)

    hi esmi, thanks for answer.. can u give me some example. i dunno what i must to do with that link.. ??

    It might help if we could see a page with your box markup in place.

    Thread Starter Rahendra Putra K?

    (@rahendz)

    here my css of rounded corner..

    .r3 {
    -moz-border-radius: 	3px;
    -khtml-border-radius: 	3px;
    -webkit-border-radius: 	3px;
    -o-border-radius:	3px;
    border-radius:		3px;
    }

    and for that i want to go like this..

    .content {
    [.r3]
    }
    
    .sidebar {
    [.rxx]
    }

    so for that, i want to call .r3 in the .content and call other rounded class in another class either.. i dont want to touch the .r3 if not necessary.. is there posibble?

    .content .r3
    {
       -khtml-border-radius: 3px;
       -webkit-border-radius: 3px;
       -o-border-radius: 3px;
       border-radius: 3px;
    }
    .sidebar .r4
    {
       -khtml-border-radius: 4px;
       -webkit-border-radius: 4px;
       -o-border-radius: 4px;
       border-radius: 4px;
    }

    Also you could declare many elements and use the same class like.

    .navigation .r,
    .content .r,
    .sidebar .r
    {
       -khtml-border-radius: 3px;
       -webkit-border-radius: 3px;
       -o-border-radius: 3px;
       border-radius: 3px;
    }
    
    .sidebar-2 .r,
    .sidebar-home .r
    {
       -khtml-border-radius: 4px;
       -webkit-border-radius: 4px;
       -o-border-radius: 4px;
       border-radius: 4px;
    }

    Add a bit of code in functions.php to create a new sidebar, then a file for the new sidebar sidebar-home.php

    <?php if ( ! dynamic_sidebar( 'sidebar-home' ) ) : ?>
    	<p><?php echo __( 'Add widgets to the Home Sidebar, Admin > Appearance > Widgets', 'themenamespace' ); ?></p>
     <?php endif; ?>

    Then call it in home.php or index.php a page file.

    <div class="sidebar-3 r">
    <?php get_sidebar('home'); ?>
    </div>

    HTH

    David

    Thread Starter Rahendra Putra K?

    (@rahendz)

    thanks david.. ok, so the point is we cant calling class inner class right? like..

    .class {
        .class_other;
    }

    rather than..

    .class, .class_other {
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘calling class in a class?’ is closed to new replies.