我的按钮周围有一个边框,当我点击屏幕上的某个地方时,它会消失

时间:2018-03-23 10:17:03

标签: html css button border styling

我遇到了一个问题,当我们第一次加载时,我的按钮周围有一个边框(不同浏览器中有不同的颜色,蓝色为safari,黑色为镀铬)。我猜它是某种选择,但我想禁用它。我怎么能这样做,初始加载按钮没有边框。这就是我的意思:

enter image description here

3 个答案:

答案 0 :(得分:1)

它被称为大纲。试试这个:

button:focus {outline:0 !important;}

值得注意的是,如果删除它将成为可访问性问题。

答案 1 :(得分:0)

此边框是大纲。它是由浏览器提供的 您也可以使用:

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.demo</groupId>
    <artifactId>springHibernate</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>springHibernate</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
                <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

答案 2 :(得分:0)

Click here for more information.

如果要删除它,请使用此功能。

&#13;
&#13;
.buttonclass {
outline:none;
}
&#13;
<button class="buttonclass">Button</button>
&#13;
&#13;
&#13;

如果你想保留它,但你不想让它显而易见,请使用它。

&#13;
&#13;
.buttonclass:focus {
outline:hidden;
}
&#13;
<button class="buttonclass">Button</button>
&#13;
&#13;
&#13;

但是我不认为按钮有轮廓。