css属性不会影响<a> link within </a> <li> <a> joomla 3.6

时间:2018-05-13 22:00:28

标签: css joomla html-lists

In my css file I have

.myclass > ul > li > a {
  display:inline;
  list-style-type:none;
}

both this style properties display and list-style-type are not working within "a" tag. However they are working if placed within "li" which does not serve the purpose because I want links which are aligned horizontally. Please advise what can be done.

<div class="myclass"> 
<ul> 
<li><a href="">About Us </a></li>
<li><a href="">About Us </a></li>
<li><a href="">About Us </a></li>
</ul>
</div>

1 个答案:

答案 0 :(得分:0)

It looks like you're targeting the wrong elements here - essentially <a> has a list-style-type of none and is inline already anyway, so you're not seeing anything happen. list-style-type is something that will affect the <li> rather than the <a>:

.myclass > ul > li {
  display: inline;
  list-style-type: none;
}

To help make this a little clearer, you could also try adding a property that would have a visible impact on your <a> elements, like color:

.myclass > ul > li > a {
  display:inline;
  list-style-type:none;
  color: hotpink;
}

Then you'll see that your selector was working - it just wasn't having any impact.