html - css: text-align: center only working on multiline text, not single line? -
the problem shown in link below - text overlaying images centers correctly when it's multiple lines... problem persists when scaling window.
the html:
<body> <div id="navbar"> ... </div> <div class="picframe" id="pf1"></div> <div class="picframe" id="pf2"></div> <div class="picframe" id="pf3"></div> </body> i'm adding pictures js, appending each picframe in turn. js:
$("#pf1").append('<div class="cont"><img src="pics/' + a[i][0] + '"><span>' + a[i][1] + ' - ' + a[i][2] + '</span></div>'); the relevant css:
span { display: block; color: white; bottom: 25px; position: absolute; margin: 5px; } .cont { position: relative; text-align: center; } .picframe { display: inline-block; width: 32%; } img { margin: 0 0 4% 0; border-radius: 4%; width: 100%; } so question - why doesn't single line text center, , how fix this?
thank in advance, j.
without working example go on, might work add this:
span {width: 100%} that worked in code reconstructed, might not relate actual situation.
Comments
Post a Comment