Vertical Image Alignment in HTML Newsletter Without Using Flexbox

I've been working hard on creating an HTML email newsletter. I've organized the layout using various tables and inline CSS. Check out a live demo of my newsletter here.

One issue I'm facing is with an image labeled "Fright Night" in column 1 of a two-column layout. I'm trying to center the image vertically next to the content in column 2, but it's giving me a hard time.

Here's a snippet of my CSS code:

/* two columns */
    .two-columns.last {
        padding: 15px 0;
    }
    .two-columns .padding {
        padding: 20px;
    }
    .two-columns .content {
        font-size: 15px;
        line-height: 20px;
        text-align: left;
    }
    .button {
        background-color: #ffffff;
        color: #171a1b;
        text-decoration: none;
        padding: 12px 20px;
        border-radius: 5px;
        font-weight: bold;
    }
    .button-dark {
        background-color: #171a1b;
        color: #ffffff;
        text-decoration: none;
        padding: 12px 20px;
        border-radius: 5px;
        font-weight: bold;
    }

In the HTML below, you can see how I have structured it using tables:

<!-- TWO COLUMN SECTION -->
            <tr>
                <td style="background-color: #26292b; color: #ffffff;">
                    <table width="100%">

                        <tr>
                            <td class="two-columns last">

                                <table class="column">
                                    <tr>
                                        <td class="padding">
                                            
                                            <table class="content">
                                                <tr>
                                                    <td>
                                                        <a href="LINK"><img src="img/2022-Fright-Night.png" alt="" width="260" style="max-width:260px;"></a>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>

                                <table class="column">
                                    <tr>
                                        <td class="padding">
                                
                                            <table class="content">
                                                <tr>
                                                    <td>
                                                        <p style="font-weight: bold; font-size: 18px;">Fright Night</p>
                                                        <p style="padding-bottom: 16px;">Do you like chills and fright? Then, join St. Auggies' youth at Frontier City's Fright Night on Friday, October 28 from
                                                        6:00pm-10:00pm. Tickets are $42.99/per person. Open to youth and adults 12 & up.</p>
                                                            <a href="LINK" class="button">Sign Up</a>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>

                            </td>
                        </tr>

                    </table>
                </td>
            </tr>

If you have any suggestions or recommendations for improvement, check out the full code here.

Answer №1

modification in css styling for .two-columns .column

    width: 100%;
    max-width: 300px;
    display: inline-block;
    vertical-align: middle;
    text-align: center;

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

Inconsistent expansion panel widths observed in Chrome when using React material-ui

I've encountered an issue in Chrome where the width adjusts to fit its content instead of taking up the full width of the container. However, this problem does not occur on Firefox. https://i.stack.imgur.com/HyWGU.png When I click on the expand icon ...

I am attempting to display a JSON array in an angular application

How can I display a JSON Array on the UI using AngularJS? I have the JSON array in the controller, and I'm attempting to retrieve it in the view. Below is the code snippet of what I have implemented. Please provide feedback on whether my approach is ...

How to utilize the translateY() method to seamlessly shift concealed elements with no empty space

My goal is to create an interactive animation that reveals a specific section when a user clicks on an element. Initially, this section is hidden from view using the translateY(-700px) property. However, I have noticed that applying a transition effect to ...

jQuery Draggable Slider Scale

Seeking a draggable ruler (meaning it scrolls on double click) similar to the one showcased in the following link: I would greatly appreciate any assistance in finding a library that can provide this same functionality. View image here: https://i.sstatic ...

Receiving partial data through the API

My PHP API seems to be experiencing issues when I send data to it using either a post or get request. The strange thing is that the API receives only half of the data. This API functions perfectly fine on localhost, but encounters errors when used on the p ...

Creating a custom image picker tailored for specific content

As I embark on creating a new page, my goal is to choose an image from a collection of previously uploaded images. Despite hours spent searching for a viable solution, I have come up empty-handed. I am well-versed in the process of uploading and displaying ...

What are some ways to display unprocessed image data on a website using JavaScript?

I have an API endpoint that provides image files in raw data format. How can I display this image data on a website using the img tag or CSS background-image property, without utilizing canvas? One possible approach is shown below: $.get({ url: '/ ...

Can changes made to an element's style in Firebug be automatically applied to the unminified CSS/LESS files?

Is it possible to efficiently modify a page with minified stylesheet and see the changes reflected back in the source code using smart IDEs, F12 tools, and 3rd party plugins or software? I typically create basic CSS, test it on the browser, tweak styles u ...

What safety measures should be implemented when granting users permission to modify HTML and CSS on your site?

I'm really impressed by the customization options on Tumblr. Users can edit the HTML and CSS of their profiles, which is something I'd love to incorporate into my own site. However, I'm concerned about the security implications of allowing t ...

Python Flask login screen not showing error message

Currently, I'm in the process of developing a login screen that incorporates Bootstrap and utilizes jQuery keyframes shaking effect. The backend functionality is managed by Flask. However, I seem to be encountering an issue where the error message "Wr ...

I have a particular scenario in mind and I am looking for the desired outcome using jQuery

I attempted a similar approach to this code snippet but did not achieve the intended result: $('div').contents().filter(function() { return this.nodeType === 3; }).wrap( '<p></p>' ).end().filter( 'br' ).remove(); ...

Overlap of text boxes in Bootstrap login form

I have tried looking at other solutions for this issue but none have worked for me. I am really confused by this problem. https://i.sstatic.net/TnKND.png The border on the right side is overlapping. Here is my CSS for the box: input[type=text], input[ty ...

Disable the background color css when hovering over a button

I'm having trouble with my Angular and HTML code. https://i.stack.imgur.com/Ea5oV.png The image above shows that a background color appears when hovering over the first icon. I've attempted: .sidemenuitm { padding: 10px 5px; cursor: poin ...

Grouping and retrieving values from an array of JavaScript objects

I am looking to implement a groupBy function on the object array below based on the deptId. I want to then render this data on a web page using AngularJS as shown: Sample Object Array: var arr = [ {deptId: '12345', deptName: 'Marketin ...

pointing out the existing issues with the menu

I am struggling to figure out why I cannot highlight the current menu page on a navigation bar (aside from the fact that I am a complete beginner :-) I have tried using a JQuery function that I found online, but none of them seem to work. Here is the funct ...

The 8 x 8 grid I am constructing is functional, however, the issue lies in the fact that the first line only begins with a single # symbol

I am attempting to create an 8 x 8 grid. It's coming together, but the issue is that the first line only starts with one # sign. function print(msg) { console.log(msg); return msg; } let result = ""; for(let i=1; i<=8; i++) { result += ...

Issue in Chrome where hover state does not persist after clicking, occurring sporadically

It's surprising that I couldn't find any information about this on Google. This bug is really annoying, and I'm not sure if it can be fixed without an update from Google for their browser. Description of the issue: When clicking on an eleme ...

Expanding the axes using Google Charts

Seeking to Expand Y-Axis I am attempting to stretch the Y-axis so that it counts up to 300 instead of just 100. The issue arises when I adjust the Y-axis to reach 300, as the values remain in the same position as they did when counting to 100. Fo ...

What is the process for adding an external HTML code to an email signature?

I have been able to create an interactive HTML email signature using the <map> parameter with my email provider. However, I am wondering if it is possible to pull the <map> code from an external HTML file on my server rather than hardcoding it ...

Ensure that all of the <li> elements within a <ul> container have equal widths

I've been grappling with this problem for the past day, and despite restarting from scratch multiple times, I can't seem to make a horizontal CSS flyout header function as intended. The dropdown section should expand to fit the content width (id ...