如何在悬停时更改伪类元素上的SVG的颜色?

时间:2019-01-22 17:09:45

标签: css3 svg css-selectors

我试图在悬停时更改SVG的颜色。我在Drupal 8中动态插入了一个无序列表。我可以使用:before伪类和背景图像将不同的SVG添加到每个单独的锚标签中。但是,现在我需要在悬停时将SVG的颜色更改为白色。任何想法如何解决这个问题?

我试图用css进行悬停更改,但是我无法更改颜色。我尝试通过javascript访问并更改fill / color / stroke属性,但我也无法做到这一点。

HTML标记:

buildscript {

    ext {
        springBootVersion = '2.0.0.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE")
    }
}

apply plugin: 'java'

apply plugin: 'eclipse'

apply plugin: 'org.springframework.boot'


group = 'com.example'

version = '0.0.1-SNAPSHOT'

sourceCompatibility = 1.8

repositories {

    mavenCentral()

    maven {

        url 'https://jitpack.io'

    }
}

dependencies {
    compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.46'

    compile('org.springframework.boot:spring-boot-starter-data-jpa:2.0.0.RELEASE')
    compile('org.springframework.boot:spring-boot-starter-web:2.0.0.RELEASE')
    compile('javax.validation:validation-api:2.0.0.Final')
    compile('org.apache.commons:commons-lang3:3.6')
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.14.Final'
    compile files('lib/gsf-3.0.jar')

    // new
    compile ('com.voodoodyne.jackson.jsog:jackson-jsog:1.0')
    compile('org.springframework.boot:spring-boot-starter-security:2.0.0.RELEASE')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf:2.0.0.RELEASE')
    compile('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.3.0')
    compile ('com.google.guava:guava:23.3-jre')
    compile('org.springframework.session:spring-session:1.3.1.RELEASE')
    compile('org.springframework.session:spring-session-data-redis:1.3.1.RELEASE')
    compile('org.glassfish:javax.el:3.0.1-b08')
    compile("com.querydsl:querydsl-core:4.1.4")
    compile("com.querydsl:querydsl-jpa:4.1.4")
    compile("com.querydsl:querydsl-apt:4.1.4")
    compile('org.springframework.data:spring-data-redis:2.0.5.RELEASE')
    compile('org.springframework.data:spring-data-jpa:2.0.5.RELEASE')
    compile('org.springframework.security.oauth:spring-security-oauth2:2.3.3.RELEASE')

    compile('org.springframework.security:spring-security-core:5.0.3.RELEASE')
    compile('com.squareup.okhttp3:okhttp:3.8.0')
    compile('com.squareup.retrofit2:retrofit:2.3.0')
    compile('com.github.iamport:iamport-rest-client-java:0.1.10')
    compile('com.alibaba:fastjson:1.2.47')
    compile ('org.json:json:20180813')
    compile ('org.apache.xmlgraphics:batik-transcoder:1.7')
    compile('org.springframework:spring-test:2.5')
    compile('commons-validator:commons-validator:1.6')

    runtime('mysql:mysql-connector-java')
    compileOnly('org.projectlombok:lombok:1.16.20')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

我需要将悬停li标签上的SVG颜色从蓝色更改为白色

0 个答案:

没有答案