I am new to html / css and ask a question about the data displayed in html format. I have a long list that I want to split and show in html format as two separate columns. For example, instead of:
Col1 Col2 1 a 2 a 3 a 4 a 5 b 6 b 7 b 8 b
I want to see the text as
Col1 Col2 Col1 Col2 1 a 5 b 2 a 6 b 3 a 7 b 4 a 8 b
What should my html / css code look like to have this data above in a split table?
For the first output, seeing all the data in 2 columns in one table, I use python code:
start = '''<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta></head> ''' font_size = '14pt' style = '''<style media="screen" type="text/css"> table.table1 { border-collapse: collapse; width: 20%; font-size: '''+font_size+'''; } td { text-align: left; border: 1px solid #ccc; } th { text-align: left; border: 1px solid #ccc; background-color: #072FB1; } </style> ''' title = '''<div align="center"></br><font size = "24"><strong>'''+title+'''</strong></font></br></br></</div>''' df_data1 = df_data[1:10] data = df_data1.to_html( index = False, na_rep ='' ) data = data.replace('None', '') style_headers = 'background-color: #072FB1; color: #ffffff;' style_status_new ='background-color: #587EF8; color: #ffffff;font-weight:bold' style_first_col = 'font-weight:bold;' total = 'TOTAL' soup = bs4.BeautifulSoup(data) soup.thead.tr.attrs['style'] = style_headers html = start+lentos+style+'''<body bgcolor="#FFFFFF">'''+title+time+unicode.join(u'\n',map(unicode,soup))+finish try: with open(dir_files+'engines_tv_html.html', 'w') as file: file.write(html.encode('UTF-8')) except Exception, e: log_error()
Where in df_data[1:10] I share my data to separate data_frames. So the question is to see the broken data_frame (one table on the left and another on the right) on one html page
source share