Achieving Vertical Center Alignment in CSS

I'm having trouble understanding what's happening here:

My goal is to vertically center an iframe and another div, both positioned alongside each other horizontally.

What I've attempted is placing the iframe and div inside a new div called 'iframe_r_container' with absolute positioning and display set as table.

Here is the updated HTML structure:

<body id="container">

    <div id="menu_bars">
        <div id="main_bar">
            <ul>
                <li class="maintabs"><a href="#">a</a></li><li class="maintabs"><a href="#">b</a></li><li class="maintabs"><a href="#">c</a>
                </li><li class="maintabs"><a href="#">d</a></li>
            </ul>           
        </div>  

        <div id="filemenu">
            <ul>
                <li class="filetabs"><a href="#">File</a></li><li class="filetabs"><a href="#">Edit</a></li><li class="filetabs"><a href="#">Settings</a></li>
            </ul>
        </div>
    </div>

    <div id="iframe_r_container">
        <iframe id="iframing" src="mannequin.html" frameborder="0" ></iframe>

        <div id="right_container">
            <div id="user_credit">
                <h1><a href="#">Username</a></h1><br />
                 has <span id="credits">000</span> credits.
            </div>

            <div> <button id="template_button"><img src="images/Coutallure-WebApp/template_button.png" /><span>Templates</span></button> </div>

    <!-- contains the jquery widget for displaying the features, i.e. buttons, zips etc -->
            <div id="features_container">

            </div>
        </div>
    </div>  </body></html>

Updating the CSS:

/* START OF RESETS */
html, body, div, span,
object, iframe, h1, h2, h3, h4, h5,
h6,  p, blockquote, pre, a, abbr,
address, cite, code, del, dfn, em,
img, ins, kbd, q, samp, small, strong,
sub, sup, var, b, i,  dl, dt, dd, ol,
ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead,
tr, th, td, article, aside, canvas,
details, figure, figcaption, hgroup,
menu, footer, header, nav, section,
summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-family: Helvetica, 'Myriad Pro', Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    font-size: 10px;
    color: rgba(34,34,34,1);
}
a img {border: 0;} /* END OF RESETS */

#container {
    width: 960px;
    height: 100%;
    background: rgba(255,255,255,0.8);
    margin: 0 auto; 
    position: relative;
}

#menu_bars {
    position: relative;
    width: 960px;
    margin: 0 auto;
}

/* START OF MAIN BAR */
#main_bar ul {
    float: left;
    width: 630px;
    height: 48px;
}

Continuing with the CSS...

/* START OF IFRAME_R_CONTAINER */
#iframe_r_container {
    display: table;
    position: relative;
    top: 48px;
    bottom: 38px;
    width: 960px;
}

/* START OF IFRAME */
#iframing {
    display: table-column;
    width: 640px;
    height: 480px;
    margin: 10px auto;
}
/* END OF IFRAME */


/* START OF RIGHT CONTAINER */
#right_container {
    display: table-column;
    width: 113px;
    margin: 20px;
}

#user_credit {
    font-size: 10px;
    text-transform: lowercase; 
    line-height: 8px;
    margin-bottom: 20px;
}

#user_credit h1 a {
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
}

#template_button {
    width: 130px;
    height: 28px;
    background: rgba(238,238,238,0.8);
    border: 1px solid rgba(0,0,0,0.2);
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    margin-left: -10px;
}

#template_button img {
    margin: 3px 6px 4px 0px;
}

#template_button span {
    vertical-align: 11px;
}

#feature_container {
    width: 300px;
    height: auto;
    display: inline-block;
}

/* END OF RIGHT CONTAINER */
/*END OF IFRAME_R_CONTAINER */

Answer №1

You might find this helpful: -

The concept of table-column is new to me.

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

Next.js: Customizing the output format of CSS Modules classes

I'm a beginner with NextJS. I'm looking to update the CSS classes prefix + suffix to this new format: <li class="desktop__menu-item--2feEH"></li> <li class="desktop__menu-item--2feEH"></li> <li class ...

deactivating image mapping on mobile media screens

I'm looking to disable my image map on mobile screens using media queries. I've attempted to include some javascript in the head of my html file, but I encountered an error: <script src="http://code.jquery.com/jquery-1.11.3.min.js"></s ...

The Evolution of Alternatives to contentEditable

Related: ContentEditable Alternative I am curious about the timeline of online WYSIWYG editors prior to the existence of contentEditable. I remember using GDocs and GMail with rich-text features that functioned similarly to contentEditable. I would appre ...

Styling with Radial Gradients in CSS

Struggling to create a banner with a radial gradient background? I'm almost there, but my code isn't matching the design. Any assistance would be greatly appreciated as I can't seem to get the right colors and only part of the first circle i ...

Adjust the color of the text within a div element when hovering over and moving the mouse away

Is there a way to change the text color on mouse hover and mouse out, even with multiple nested div elements? I'm having trouble getting it to work, so any help would be appreciated. <div class="u860" id="u860" style="top: 0px;"> <div id ...

Iterate through each of the selected checkboxes

Can anyone provide guidance on this issue? I am dealing with two web pages - one containing multiple check boxes in a form that POSTs to the second page. Is there a method to pass all the checked checkboxes' values to the second page in order to deter ...

I'm struggling to make my div display inline

My div elements are not displaying inline, I'm thinking maybe I shouldn't use the nav and div structure like this. But starting over again seems like a lot of work. How can I fix this issue? Just so you know, I'm only on my 4th day of learn ...

Tips on adjusting the width of a border

I'm facing a challenge with my select box setup: <select class="selectpicker" multiple data-live-search="true" name="color[]" title="Nothing selected yet"> <option class="" style="border-bottom:2px solid; border-color:red" value="">Red&l ...

The optimal method for loading CSS and Javascript from an ajax response within a JavaScript function - Ensuring cross-browser compatibility

I am in a situation where I need jQuery to make sense of an ajax response, but due to latency reasons, I cannot load jQuery on page load. My goal is to be able to dynamically load javascipt and css whenever this ajax call is made. After reading numerous a ...

Conceal or style the filter panel in a DT datatable

Here is an example to consider: library(DT) L <- 10 datatable( data.frame( var1 = sapply(1:L, function(x) paste("<X>",paste0(x, letters, LETTERS, "\n", ...

Looping through mysql data horizontally within a div tag

Looking for assistance to create a content loop similar to the one on this website? I attempted to use a while() loop, but it ended up displaying vertically without using a table. I suspect this page utilizes thumbnails. What I aim for is to have the it ...

What is preventing this code from setting the background color of the main content all the way to the bottom of the

I designed this webpage using HTML and CSS. ... #contents { margin: 0px; padding: 0px; width: 100%; background-color: white; color: black; border-top: 3px solid black; background-image: url(img/CloverImage.png); background ...

HTML 5 Video VTT File: A must-have for optimal video playback

Having trouble getting the subtitle.vtt file to load on Chrome with this code. Can anyone offer any insights? <div id="videoKilledTheRadioStar"> <video id="Tutorial" width="420" autoplay controls> <source src="videos/shaco.mp4" type="vi ...

The min-height property does not seem to be compatible with -webkit-calc

I've been experimenting with this code: .main{ min-height: -moz-calc(100% -50px); min-height: -webkit-calc(100% -50px); min-height: calc(100% -50px); background-color:#000; color:white; } html{ height:100%; } <html ...

The background color of the columns is overwhelming

I would like to create a TV remote control design using bootstrap, but I am encountering some issues. The background color is overflowing and I'm unsure how to fix it. Please take a look at the code and feel free to offer any suggestions! @media scre ...

Ways to eliminate the Vuetify append-icon from the sequential keyboard navigation

In my Vue.js application using Vuetify, I have implemented a series of password fields using v-text-field with an append-icon to toggle text visibility. Here is the code snippet: <v-text-field v-model="password" :append-icon="show1 ? 'mdi-eye& ...

Issue encountered while implementing async functionality in AngularFireObject

I'm encountering difficulties with the async feature in AngularFireObject. Is there a solution available? Snippet from HomePage.ts: import { AngularFireObject } from 'angularfire2/database'; export class HomePage { profileData: Angu ...

HTML: Attempting to extract the inner div from the outer div and relocate it outside of the outer div

I am attempting to extract an inner div from an outer div and relocate it outside of the outer div. https://i.stack.imgur.com/NSS7B.png <div class="vc_gitem-zone-mini"> <div class="vc_gitem_row.............."></div> <div> I Would ...

What is the best way to eliminate the gap between spans in Bootstrap?

Imagine you have the following code: <div class="row-fluid"> <div class="span6"></div><!--span6 END--> <div class="span6"></div><!--span6 END--> </div><!--row END--> Now envision two red b ...

Capturing text content in an HTML attribute - using Selenium

In my research, I found that most questions were about extracting text from <p> ... </p> tags. However, what I am curious about is whether Selenium can be used to extract text from an HTML attribute like this: <li id="bullet" someid="1003"& ...