html - Div position changed due to text wrap (css) -
i have layout below show pics , texts in individual divs. my problem here when text long, position of div changed , looks not nice.
for example, may run snippet below , see div text "trellis combined line chart", can find it's position moved due too-long-text.
do have solution issue? many thanks!
p.s. think styles need care below "pic_small_container", "pic_small" , "demo_illus".
.overallpanel1 { border-width: 1px; border-color: #bdbdbd; margin: 1.875em 0 3.75em 4.065em; } .pic_small { border: solid; border-width: 1px; border-color: #bdbdbd; width: 12.5em; height: 10.4em; } .pic_small_container { text-align: center; padding: 0 4em 4.375em 0; display: inline-block; } .demo_illus { text-decoration: none; font-family: 'arial'; font-weight: 200; font-style: normal; font-size: 0.875em; color: #3498db; } .overview_page_title { text-decoration: none; font-family: 'calibri'; font-weight: 700; font-style: normal; font-size: 1.1em; margin-left: 1.875em; } .overview_chart_title { text-decoration: none; font-family: 'calibri'; font-weight: 500; font-style: normal; font-size: 1.1em; } .picpanel { margin-top: 1.125em; }
<!doctype html> <html> <head> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta charset="utf-8"> <title>chart demo overview</title> <link href="resources/demostyle.css" rel="stylesheet"> </head> <body> <div style="margin-top: 0.9em"> <a class="overview_page_title">demo overview</a> <div class="overallpanel1"> <a class="overview_chart_title">trellis</a><br> <div class="picpanel"> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_bar">trellis chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_stacked_bar">trellis stacked bar chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_line">trellis line chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_pie">trellis pie chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_donut">trellis donut chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_combination">trellis combined column line chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_horizontal_combination">trellis combined bar line chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_bubble">trellis combined bubble chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_scatter">trellis combined scatter chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"><br> <a class="demo_illus" href="index.html?charttype=trellis_area">trellis area chart</a> </div> </div> </div> </div> </body> </html>
hi here answer little change in css.
find comment mentioned in css code
.pic_small { border: solid; border-width: 1px; border-color: #bdbdbd; width: 12.5em; height: 10.4em; } .pic_small_container { text-align: center; padding: 0 4em 4.375em 0; display: inline-block; /*this magic want*/ vertical-align: top; } .demo_illus { text-decoration: none; font-family: 'arial'; font-weight: 200; font-style: normal; font-size: 0.875em; color: #3498db; /* overflow hidden. width applicable <a> if add property display:block; or display:inline-block; */ overflow: hidden; width: 12.5em; display: block; } .overview_page_title { text-decoration: none; font-family: 'calibri'; font-weight: 700; font-style: normal; font-size: 1.1em; margin-left: 1.875em; } .overview_chart_title { text-decoration: none; font-family: 'calibri'; font-weight: 500; font-style: normal; font-size: 1.1em; } .picpanel { margin-top: 1.125em; }
<!doctype html> <html> <head> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta charset="utf-8"> <title>chart demo overview</title> <link href="resources/demostyle.css" rel="stylesheet"> </head> <body> <div style="margin-top: 0.9em"> <a class="overview_page_title">demo overview</a> <div class="overallpanel1"> <a class="overview_chart_title">trellis</a> <br> <div class="picpanel"> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_bar">trellis chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_stacked_bar">trellis stacked bar chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_line">trellis line chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_pie">trellis pie chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_donut">trellis donut chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_combination">trellis combined column line chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_horizontal_combination">trellis combined bar line chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_bubble">trellis combined bubble chart long text div</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_scatter">trellis combined scatter chart</a> </div> <div class="pic_small_container"> <img class="pic_small" src="resources/svg/horizontal_line.svg"> <br> <a class="demo_illus" href="index.html?charttype=trellis_area">trellis area chart</a> </div> </div> </div> </div> </body> </html>
Comments
Post a Comment