Connecting Tech Pros Worldwide Forums | Help | Site Map

HTML inline styles for 3 column tabless

KUB365's Avatar
Administrator
 
Join Date: Jul 2005
Location: Portland, OR
Posts: 973
#1: Nov 2 '08
To speed up developing i am using a lot of inline code vs stylesheets.

Mainly using the style= attribute in divs, spans, and p.

Is this the best way to do 3 column inline? or is there an easier way. I nested the divs.
Expand|Select|Wrap|Line Numbers
  1. <!-- container -->
  2. <div style="width: 800px; border: 1px solid #ccc;">
  3.     <div style="background-color:#009999; float: left; width:550px;">
  4.         column 1
  5.     </div>
  6.     <div style="background-color: #CCCCCC; width: 250px; float: right;">
  7.         <div style="float: left; width: 100px;">
  8.         column 2
  9.         </div>
  10.         <div style="background-color:#66FFCC; width: 150px; float:right;">
  11.         column 3
  12.         </div>
  13.     </div>
  14. </div>
  15. <!-- containter end -->

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,574
#2: Nov 2 '08

re: HTML inline styles for 3 column tabless


There are a lot of ideas floating around on how to do it. I don't know if you cooked that one up on your own but I can get you some links to samples or look up some of my own (since I can't remember how I do my own stuff the day after). Yours looks good, though.
Expert
 
Join Date: Aug 2008
Posts: 397
#3: Nov 2 '08

re: HTML inline styles for 3 column tabless


Best is a matter of opinion. What you have will work as intended in compliant browsers. If you also want it to work in non-compliant browsers -- any version of Internet Explorer -- you'll need a doctype. Either way:
Expand|Select|Wrap|Line Numbers
  1. Add overflow:hidden to enclose the floats.
  2. <div style="width: 800px; border: 1px solid #ccc;overflow:hidden">
  3.  
  4.  
Reply