Trouble converting html layout from table to divs & css -


i have old web application i'm trying update. in original design html tables used extensively layout both non-tabular , tabular data. i'm trying "modernize" app removing html table layout , replacing divs , css. below example of small amount of information in table , i've converted divs , css. problem css not generic extending level of entire app doesn't seem practicle. unfortunately, can't think of better way lay out. i'm looking ideas of better way perform type of layout using divs , css.

this small page i've converted. have other screens of app have similar layouts larger amounts of data , i'd suggestion of approach laying out. i'm not looking rewrite code. need fresh idea doesn't require 4 lines of css every cell of old table layout.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>test</title> <style> #headerdata {     position: absolute;     background-color: #ccc;     left: 10;     width:800px;     top: 10;     height: 130px;     clear: both;     border: medium solid #999; } #headerdata h2 {     top: -15px;     position: absolute;     left: 10px; } .datalabels{     text-align: right; } .datafields {     text-align: left;     color: #00f;     padding-left: 2px;     background-color: #fff;     border: thin solid #999; } .rowone {     position: absolute;     top: 43px;     height: 19px; } .rowtwo {     position: absolute;     top: 70px;     height: 19px; } .rowthree {     position: absolute;     top: 96px;     height: 19px; } .colone {     left: 15px;     width: 151px; } .coltwo {     left: 171px;     width: 80px; } .coltwospanthree {     left: 171px;     width: 265px; } .colthree {     left: 260px;     width: 92px; } .colthreespantwo {     left: 260px;     width: 243px; } .colfour {     left: 360px;     width: 143px; } .colfourfive {     left: 440px;     width: 65px; } .colfive {     left: 517px;     width: 64px; } .colfivesix {     left: 512px;     width: 272px; } .colsix {     left: 589px;     width: 122px; } .colseven {     left: 720px;     width: 69px;     text-align: center;     background-color: #9c0; } </style> </head>  <body> <div id="headerdata">   <h2>work order</h2>   <div class="rowone colone datalabels">order:</div>   <div class="rowone coltwo datafields">3105-001</div>   <div class="rowone colthree datalabels">parent:</div>   <div class="rowone colfour datafields">3105</div>   <div class="rowone colfive datalabels">project:</div>   <div class="rowone colsix datafields">2013 diskproj</div>   <div class="rowone colseven">open</div>   <div class="rowtwo colone datalabels">customer:</div>   <div class="rowtwo coltwo datafields">micr01</div>   <div class="rowtwo colthreespantwo datafields">microsoft corporation</div>   <div class="rowtwo colfive datalabels">estimate:</div>   <div class="rowtwo colsix datafields">5248 rev a</font></div>   <div class="rowthree colone datalabels">item:&nbsp;<span style="font-family: wingdings; background-color: #fff;">&#254;</span></div>   <div class="rowthree coltwospanthree datafields">2016 office dvd</div>   <div class="rowthree colfourfive datalabels">desc:</div>   <div class="rowthree colfivesix datafields">2016 ofc distribution disk</div> </div> </body> </html>     

one suggestion add bootstrap project. bootstrap has inbuilt classes support "row" , "col", through can mock table structure.

<div class="row">     <div class="col-md-2"></div>     <div class="col-md-4"></div>     <div class="col-md-8"></div> </div> 

it idea define height , width percentages rather actual pixel support window resizing. (although there may definitive cases strict pixel definition required).


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -