鼠标悬停在跨度上并不起作用

时间:2017-07-01 07:51:20

标签: css css3 mousehover

假设有这个html:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XamarinFormsOne.Pages.GPSOwnTestPage"
             BackgroundColor="{StaticResource PageBackgroundColor}">
    <ContentPage.Content>
        <StackLayout>
            <Button x:Name="btnGetLocation"
                    Text="Get GPS Avability"
                    Clicked="Button_Clicked"/>
            <Label x:Name="labelLatitude"
                   HorizontalOptions="CenterAndExpand"
                   VerticalOptions="CenterAndExpand"
                   TextColor="White"/>
            <Label x:Name="labelLongitude"
                   HorizontalOptions="CenterAndExpand"
                   VerticalOptions="CenterAndExpand"
                   TextColor="White"/>
            <StackLayout Orientation="Horizontal" x:Name="settingsLayout">
                <Grid WidthRequest="120"/>
                <Image x:Name="image1"
                      Source="settingsIcon.png"
                      HorizontalOptions="EndAndExpand"
                      VerticalOptions="EndAndExpand"/>
                <Image x:Name="image2"
                      Source="settingsIcon.png"
                      HorizontalOptions="CenterAndExpand"
                      VerticalOptions="EndAndExpand"/>
                <Image x:Name="image3"
                      Source="settingsIcon.png"
                      HorizontalOptions="StartAndExpand"
                      VerticalOptions="EndAndExpand"/>
                <Grid WidthRequest="120"/>
            </StackLayout>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

我需要增加字符串的大小&#34; DOG&#34; 所以我用这个css:

<a href="" class="hoverelement"><span>DOG</span></a>

但这不起作用?任何人都可以帮助我吗?

3 个答案:

答案 0 :(得分:0)

尝试将a-element赋予hover - 选择器。

a.hoverelement:hover span {
   font-size: 20px;
}

答案 1 :(得分:0)

请改用:

.hoverelement:hover span {
    font-size: 20px;
}

答案 2 :(得分:0)

您需要在span !important中添加css,因为它可能会被其父母的规则继承。

&#13;
&#13;
.hoverelement span:hover {
  font-size:20px !important;
}
&#13;
<a href="" class="hoverelement"><span>DOG</span></a>
&#13;
&#13;
&#13;