Unable to adjust table, row, and cell heights in Outlook template due to HTML/CSS formatting issues

I'm struggling to make the height of the leftmost (commented) nested table adjust automatically based on the content in the right section. It displays correctly in Chrome, but does not stretch in Word/Outlook.

Any ideas on how to fix this for Word/Outlook?

desired appearance

actual appearance

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title></title>
        <style>
                                                
            th, td {
                padding: 0;
            }
            
            table.border {
                border-collapse: collapse;
                border-spacing: 0;
            }
            
            .borderOutline {
                border: 4px solid #000000;
            }
                        
        </style>
    </head>
    <body>

    <table class="border" align="center" width="588" height="100%">
        <tbody>
            <tr valign="top">
                <td width="12">
                    
                    <!--PROBLEM TABLE START-->
                
                    <table class="border" width="100%" height="100%">
                        <tbody>
                            <tr bgcolor="red"><td>&nbsp;</td></tr>
                            <tr bgcolor="orange"><td>&nbsp;</td></tr>
                            <tr bgcolor="yellow"><td>&nbsp;</td></tr>
                            <tr bgcolor="green"><td>&nbsp;</td></tr>
                            <tr bgcolor="blue"><td>&nbsp;</td></tr>
                            <tr bgcolor="purple"><td>&nbsp;</td></tr>                           
                        </tbody>
                    </table>
                    
                    <!--PROBLEM TABLE END-->
                
                </td>
                
                <td width="576">
                
                    <table class="border" width="100%" height="100%">
                        <tbody>
                            <tr height="75">
                                <td class="borderOutline">
                                    
                                    <table cellspacing="20" cellpadding="20">
                                        <tbody>
                                            <tr>
                                            
                                                <td>HEADER</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                
                                </td>
                            </tr>
                            
                            <tr>
                                <td class="borderOutline">
                                    
                                    <table cellspacing="20" cellpadding="20">
                                        <tbody>
                                            <tr>
                                            
                                                <td>
                                                    <p>BODY</p>
                                                    <p>will</p>
                                                    <p>contain</p>
                                                    <p>variable</p>
                                                    <p>amount</p>
                                                    <p>of</p>
                                                    <p>text</p>
                                                </td>
                                            
                                            </tr>
                                        </tbody>
                                    </table>
                                
                                </td>
                            </tr>
                            <tr height="75">
                                
                                <td class="borderOutline">
                                
                                    <table cellspacing="20" cellpadding="20">
                                        <tbody>
                                            <tr>
                                            
                                                <td>FOOTER</td>
                                            
                                            </tr>
                                        </tbody>
                                    </table>
                                
                                </td>
                                
                            </tr>
                        </tbody>
                    </table>
                
                </td>                   
                
            </tr>
        </tbody>
    </table>

    </body>
</html>

Answer №1

The issue you're facing is actually quite common and has frustrated many people in the past. Based on my understanding, Word and Outlook use the Internet Explorer Engine, so you may find a potential solution to your problem in this discussion:

IE display: table-cell child ignores height: 100%

(Hint: It's likely not achievable)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

html text alignment in the center

Is there a way to align text in the center without shifting the starting position of the first letter? before text 1 text text text 2 text text after ...

Prevent border duplication in CSS and retain border visibility

Check out this fiddle where I have three divs with a border-width of 2px. Originally, the issue was that each div's border gets duplicated in between, resulting in a total border-width of 4px. To solve this, I applied a margin-top of -2px to each div, ...

Retrieve the initial value of the input element following a modification

Is there a way to retrieve the original default value of an input field after changing it using .val()? In my HTML, I have various text-inputs with classes .large and .medium, each with its own default text value. What I'm trying to achieve is when a ...

The second div element remains unselected in jQuery

Below is the example of an HTML structure: <span id="17">yes here</span> <div class="PricevariantModification vm-nodisplay"></div> <div class="PricesalesPrice vm-display vm-price-value"> <span class="a"></span> ...

What is the proper way to structure an Xpath search?

Recently, I've been working with Selenium in QA Test automation. When it comes to selecting/writing Xpath for an element, I've noticed that there are different formats that can be used. For example, protected final String LOGIN_BUTTON_LOCATOR = ...

`html2canvas encountered an issue: Unable to locate a logger instance`

When I use html2canvas to render the same content repeatedly, I encounter an error about 5% of the time. It seems to be sporadic and I'm not sure why it occurs. What could be causing this unpredictable behavior? html2canvas.js:2396 Uncaught (in promi ...

Smoothly automate horizontal scrolling using JavaScript

My programming journey involved creating a code snippet that automatically scrolls paragraphs horizontally, giving it the appearance of "Breaking News" updates on popular websites. The Javascript script I implemented performs automatic scrolling, but once ...

Stable header that jumps to the top when scrolled

I have implemented the JavaScript code below to set the header to a fixed position when it reaches the top of the page so that it remains visible while the user scrolls. Everything appears to be functional, but the header movement is abrupt and not smooth. ...

Combining the p class with flexbox for optimal layout design

I have four flexed container boxes and I am looking to add text below them in a row. Does anyone have suggestions on how I can achieve this alignment, as well as tips for optimizing the code? .container { display: flex; flex-direction: row; just ...

Convert a div into a clickable link using JavaScript without using too many classes or any ids

After using shortcodes generated by functions.php in a WordPress parent theme, I have come across the following HTML code: <div class="pricing-table-one left full-width "> <div class="pricing-table-one-border left"> <div class=" ...

Switching from real pixels to CSS pixels

The details provided in Mozilla's documentation on elementFromPoint clarify that the coordinates are specified in "CSS pixels" rather than physical pixels. This raises a question about what exactly CSS pixels entail. Many assume that a pixel in CSS is ...

What is the best way to eliminate the alert message "autoprefixer: Greetings, time traveler. We are now in the era of CSS without prefixes" in Angular 11?

I am currently working with Angular version 11 and I have encountered a warning message that states: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js): Warning "autoprefixer: Greetings, time traveler. We are now in the era of prefix-le ...

How can I ensure that Chakra UI MenuList items are always visible on the screen?

Currently, I am utilizing Chakra UI to design a menu and here is what I have so far: <Menu> <MenuButton>hover over this</MenuButton> <MenuList> <Flex>To show/hide this</Flex> </MenuList> </ ...

Can the floating side of a div be switched after resizing?

Let's say I have two divs set up in the following configuration: |------------------------------| | div1 ------------------ div2 | |------------------------------| .div1{ float:left; } .div2{ float:right; } From my understanding, they w ...

The CSS table-cell element causes adjacent table-cell content to reposition

The table inside the "center" div is causing the contents in the "left" div to be offset by a few pixels from the top (about 8 in my browser). When you add some text before the table, this offset disappears. Why is this happening? Is there a way to preven ...

Styling text of various sizes to appear together in a div container

I'm having trouble getting my text to align in a single line. I've tried using vertical-align: middle and vertical-align: bottom... Can someone please assist me? http://jsfiddle.net/2wDEw/ Here is a simple example of what I have: ...

Can you conceal the label while also displaying the placeholder?

Within my form, I am using the following code: <div id="zipcode-label" class="f-label"><label for="zipcode" class="required">Zip code</label></div> <div id="first-element" class="f-element"><input type="tel" class='ro ...

Although the ng-click HTML code functions as expected, the same code within an AngularJS function does not seem to work properly

HTML <div id="rightpane"> <div id="rightpanecontent" > <div id ="Addbtn" style="text-align: right;"> <button type="btnAdd" class="btnAddText" ng-click="addText()" style="margin-top:10px;margin-left:166px; color: white;b ...

"Enhance Your Video Experience with a Custom

Currently, I am working on designing a front-page that features a YouTube video as the background with a fixed transparent navigation. Although I have successfully implemented both elements, I am struggling to make sure the video background starts at the t ...