简体   繁体   中英

make text transparent with in div with black background but transparent text

i want to make a div with black background but the text should be transparent with red border. Any idea?

till now i have been able to make my text transparent but when i add background color to the div, it makes text background with the same color.

See this fiddle

HTML:

<div class="text">
    <h1>EXPERIENCES</h1>
</div>

CSS:

.text {
    position: absolute;
    top: 0; 
    background-color: #000;
    overflow: hidden;
}
.text h1 {

    font-size: 112px;
    -webkit-text-stroke-color: red;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke-width: 1px;

}

Try:

div { background:rgba(0,0,0,1);
      color:rgba(255,255,255,0.5);
      -webkit-text-stroke-color: red;
      -webkit-text-stroke-width: 3px;
      font-size:100px;
    }

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