473,625 Members | 3,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Split table row into two rows without specifying height

KeredDrahcir
426 Contributor
I am trying to include a table on a mobile responsive design. The table only has two columns but on the lowest resolutions the table takes up too much horizontal space.
I'm quite happy to display the columns as two rows and I have a way to achieve this but it causes problems if one of the fields is long enough to go onto more than one line.

I can recode the table as divisions but I'd like to try and avoid that if possible.

Expand|Select|Wrap|Line Numbers
  1. <table width="100%" border="0" class="my_table">
  2.     <tr style="position: relative;">
  3.             <td>First Name </td>
  4.             <td>Sarah</td>
  5.           </tr>
  6.       <tr>
  7.           <td>Last Name </td>
  8.          <td>Bellum</td>
  9.     </tr>
  10.     <tr>
  11.               <td>Company Name</td>
  12.             <td>ABC Company Limited</td>
  13.           </tr>
  14. </table>
  15.  
The CSS that spilt the table is below
Expand|Select|Wrap|Line Numbers
  1. .my_table { position: relative;}
  2. .my_table tr { height: 50px; position: relative;}
  3. .my_table tr td:last-child { padding-top: 25px; position: absolute; left: 0;}
  4.  
I’d prefer not to recode the table into divisions if I can avoid it. Is there any way to do it without giving the table row a height so that it the last cell runs onto more than one line then it won't display over the next row?

Is there any other approach I can do?
Jan 27 '15 #1
0 1430

Sign in to post your reply or Sign up for a free account.

Similar topics

7
15994
by: Bruce W...1 | last post by:
I made my first PHP page that uses includes. http://php.didah.com/main.php But I can't get rid of a gap (about 5 pixels) between the table rows. The content of each include file is one line like this: <img src="images/nav.gif" width="100" height="600" hspace="0" vspace="0" border="0"> No head or body tags. Just a 100 x 600 gif image. Here's the code for the main.php page:
12
39106
by: Rick DeBay | last post by:
I'm trying to create a layout table, where the spacing between rows varies. I've tried using setting margin-top and border-top for the rows I wan't spaced down from the one above, and I've also tried setting it on all of the cells of that row. This hasn't worked, so I was wondering if anyone knew how it could be done. Thanks, Rick DeBay
0
1028
by: namri | last post by:
Hi, I want to crypt a message with RSAPKCS1KeyExchangeFormatter with a RSAKey that I have. The only way that I see to do it is to get an initialize RSAPKCS1KeyExchangeFormatter with an instant of RSA that containt the Key. My question is can we encrypt with RSAPKCS1KeyExchangeFormatter without specifying a private
3
2884
by: Bijoy Naick | last post by:
I have something strange going on.. My .aspx page contains a file upload control, a "Import Data" button, a "newTransactions" <asp:table>, a"SaveTrans" button and an confMsg label. First the user selects a file, then clicks Import Data. The page now reads the PostedFile and displays each line as a new row in the newTransactions table. All of this works fine. For now, I've programmed SaveTrans_Click to display the number of rows in the...
1
1186
by: dananrg | last post by:
I can handle making the connections and running queries, but what's the best way to process table rows returned in Python? What about turning a table definition into an object? Just looking for ways to be efficient, since I know I will be hitting the same external RDBMS from Python and regularly processing a fixed set of tables with a certain fixed set of attribute columns. Is there something better than tuples for this?
7
13522
by: leiño | last post by:
Hi, i am adding table rows dynamically with javascript. This works fine. The table is inside a div with scrolls, initially with 6 rows: ..... <div style='overflow:auto; width:100%; height:100;'> <table> <tr><td>nothing</tr></td> <tr><td>nothing</tr></td>
6
9622
Vasuki Masilamani
by: Vasuki Masilamani | last post by:
Hi, I need a query which would convert Columns into Rows without causing any damages to the original data. I am not supposed to solve this by creating temporary tables and later dropping it. I have a table which is in the below format: Name EmployeeID Year JanExp FebExp MarExp JanHrs FebHrs MarHrs A 129178 2005 10 20 30 15 25 35 B 129213 2004 40 ...
0
1544
by: Ty | last post by:
Question: If the Division number changes in 1 table, it is suppose to automatically change in the other tables. If it don't change, what is the problem? Response: My professors response to my database problem/question: It will if you have the relationship created correctly, turn on referential integrity, and then cascade update action.
0
1477
by: geraldjr30 | last post by:
hi, i have the following: <html> <STYLE type="text/css"> TD{font-family:ARIAL;font-size:11px;color:#666666;}
1
1845
gskoli
by: gskoli | last post by:
Dear all Below i have given example of my HTML table structure Where two different <Td> are containing separate table both having same no. of rows but second table having some rows where textbox & dropdown is used which increasing the height of rows ..... So how i can manage that .... <td> <table> Having 14 row </table> </td> <td>
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.