javascript - How do I modify my CSS so that I can display an element in the DOM with a specific color? -
i trying build website using bootstrap , javascript. trying learn how implement feature show user actively engaging site displaying green bubble next profile name when logged web application. have created project , have included code in attempt show active user bubble in green instead of red bubble indicates user offline.
please see image below displays trying accomplish.
i have included code snippet clarity.
any guidance appreciated.
html
<div id="user-avtive"><span><img src="/assets/images/signin/user-online.png"></span></div>
make use of pseudo elements ::after,::before
instead of images. can try this.
.user{ font-size:15px; font-weight:bold; text-transform:uppercase; position:relative; display:inline-block; } .user::after{ content:""; height:8px; width:8px; border-radius:50px; background-color:#000000; top:0; right:-10px; margin:auto; display:inline-block; position:absolute; } .user.active::after{ background-color:#00ff00; } .user .username{ color:#0000ff; }
<div class="user active"> hi <span class="username">user</span> </div>
Comments
Post a Comment