html - Centered-fixed-width-div with fluid divs on left and right? -
i working on wordpress site.
have these decorative titles constructed this:
(the following not real html structure, example purpose)
<div class="decoration-left"> <div class="title"> <div class="decoration-right">
.title has h1 title inside.
.decoration-left, , .decoration-right, empty divs, decorative background.
need title centered time.
i first tried give 3 divs 33.3% width, worked nice on big screens, reduce window title breaks 2 lines, , looks ugly. need title have constant width therefore. dont want text smaller.
right now, have .title div "width:auto" works fine. need left , right decorative divs take each one, half of remaining space in responsive/fluid way.
attaching picture better understunding.!
my guess is: put decorative divs inside title div, , title div inside wrap div. make title div 'position: relative; display:inline-block; background:#fff;' decorative ones 'position:absolute; left:-50px;' , 'position:absolute; right:-50px;', , wrap 'text-align:center; background:url(line image link) center repeat-x;'.
i know it's hard understand, sure work way. i'll try making better coding of it:
html:
<div class="title-warpper"> <div class="title"> <div class="decoration-left"></div> <span>your title here</span> <div class="decoration-right"></div> </div> </div>
css:
div.title-wrapper { background:url(line image link) center repeat-x; text-align: center; } div.title { position:relative; background:#fff; display:inline-block; } div.decoration-right{ position:absolute; right:-25px; background:url(decoration bg link); width:25px; height:25px; } div.decoration-left{ position:absolute; left:-25px; background:url(decoration bg link); width:25px; height:25px; }
i set decoration divs 25px, use need. remember adjust them , left , right properties fit needs.
Comments
Post a Comment