html - How to create a circle and a bar that overlap with css? -
for user profile i'm trying create circular image plus horizontal bar same height image. also, should responsive. should in image below. in black bar there text.
could please me correct css?
so far have code below goes wrong in black bar below circle , not next it. don't know how make black bar start in middle of image, have image on top, , have text in black bar start sufficiently right (while being responsive screen size).
<div class="col-md-12 profile-topbar"> <div class="round"> <img src=<%= image_path('profile.gif') %>> </div> <div class="text-bar"> ... </div> </div>
in css file:
.round { margin: 2em; border-radius: 50%; overflow: hidden; width: 150px; height: 150px; -webkit-border-radius: 50%; -moz-border-radius: 50%; box-shadow: 0 0 8px rgba(0, 0, 0, .8); -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, .8); -moz-box-shadow: 0 0 8px rgba(0, 0, 0, .8); } .round img { display: block; width: 100%; height: 100%; } .text-bar { display: inline-block; background: #fff; left: 222px; //problem: not responsive. block should start halfway image. width: 100%; } .text-bar p { left: 250 px; }
you use figure
, figcaption
structure html.
inline-block
, vertical-align
, margin
set image aside text
figure { margin-left:50px;/* half image width */ background:black; box-shadow:0 0 1px; border-radius:3px; } img { border-radius:100%; position:relative;/* brings @ front, can trigger z-index */ box-shadow:-1px 0 1px, 1px 0 1px white ;/* whatever u */ vertical-align:middle; right:50px;/* move visually real position */ margin-right:-40px;/* pull or push text aside */ } figcaption { display:inline-block; vertical-align:middle; color:white; } p { margin:0; }
<figure> <img src="http://lorempixel.com/100/100/people/9" /> <figcaption> <p>some text here 10px away image</p> <p>and more</p> </figcaption> </figure>
Comments
Post a Comment