how to apply style for 'ul' and 'li' and 'a' in same class?
Asked Answered
H

1

6

i am new to front end development.. i want to apply style for <ul> and <li> and also for <a> in same class.. is it possible ?

here is my code

<html>
<head>
<title></title>
<style type="text/css"> 
.menu ul, li, a {
    text-decoration: none;
    list-style-type: none;
    padding: 10px;
    margin-left: 10px;
    border: 2px solid green;
}
</style>
</head>
<body>
    <div class="menu">
    <ul>
        <li>
            <a href="#">Home</a>
            <a href="#">Services</a>
            <a href="#">Customers</a>
            <a href="#">Locations</a>
            <a href="#">Fare</a>
            <a href="#">Contact Us</a>
        </li>
    </ul>
</div>
</body>
</html>
Heather answered 11/1, 2017 at 4:41 Comment(0)
F
19

Yes it's possible...

.menu ul { /*css here*/ }
.menu ul li { /*css here*/ }
.menu ul li a { /*css here*/ }

or

.menu ul, .menu ul li, .menu ul li a { /*css here*/ }

or

.menu ul, .menu li, .menu a { /*css here*/ }
Fertilize answered 11/1, 2017 at 4:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.