简体   繁体   中英

CSS Link style issue

My CSS looks like:

.small, small:hover { color: #000000; }

My HTML looks like:

<small>Small Text</small> 
<a href="#"><small>Small Text Link</small></a>

I'm trying to style the link in small i know its probably a simple problem but it colors the whole text and not just the link. Can anyone point me in right direction?

I'm using bootstrap so i don't want to change the color of a on its own.

You can specify that css rules for small element should be applied only if it is inside link ( a element):

a small, a small:hover { color: #000000; }

By the way, there is no point in providing the same rules for a small and a small:hover , just a small should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM