Struggling to perfectly align a Wufoo form within an iframe using CSS

I have integrated a web form from Wufoo into my webpage using an iframe. Custom CSS can be used to style the form and I am trying to center it within the iframe.

Below is the HTML code of the form displayed in the iframe:

<div id="container" class="ltr">
    <form id="form2" name="form2" class="wufoo topLabel page1 hideHeader" accept-charset="UTF-8" autocomplete="off" enctype="multipart/form-data" method="post" novalidate="true" action="https://peakinbound.wufoo.com/embed/mtco4fp0qomvz2/def/&amp;header=hide#public">
        <ul>
            <li id="fo2li1" class="notranslate">
                <label class="desc" id="title1" for="Field1">
                    Name<span id="req_1" class="req">*</span>
                </label> 
                <span> 
                    <input id="Field1" name="Field1" type="text" class="field text fn" value="" size="8" tabindex="1" onkeyup="handleInput(this);" onchange="handleInput(this);" required="true" />
                    <label for="Field1">First</label>
                </span>
                <span>
                    <input id="Field2" name="Field2" type="text" class="field text ln" value="" size="14" tabindex="2" onkeyup="handleInput(this);" onchange="handleInput(this);" required="true" />
                    <label for="Field2">Last</label>
                </span>
            </li>
            <li id="fo2li3" class="notranslate">
                <label class="desc" id="title3" for="Field3">
                    Email<span id="req_3" class="req">*</span>
                </label>
                <div>
                    <input id="Field3" name="Field3" type="email" spellcheck="false" class="field text medium" value="" maxlength="255" tabindex="3" onkeyup="handleInput(this);" onchange="handleInput(this);" required="true" />
                </div>
            </li>
            <li class="buttons ">
                <div>
                    <input type="hidden" name="currentPage" id="currentPage" value="jssDPjBF2iK6t1UvInla0mSUbe82kYF5HwuBetLwuBe5y49jw=" />
                    <input id="saveForm" name="saveForm" class="btTxt submit" type="submit" value="Get Info" onmousedown="doSubmitEvents();" />
                </div>
            </li>
        </ul>
    </form>
</div>
<!--container-->

I attempted to center the form using the following CSS, but it did not work:

#container {
    width: 350;
    height: 250; 
    margin:0 auto;
}

Do you have any suggestions on how to successfully center this form?

Appreciate your assistance.

Answer №1

To accurately measure the dimensions, ensure to specify a unit of measurement in pixels.
Example Link
Live Demo

#iframe-container {
    width: 350px;
    height: 300px; 
    margin:0 auto;
}
#iframe-container > iframe {
    overflow-y: auto;
    border: none;
    height: 100%;
    width: 100%;
}

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

Having difficulty adjusting the padding of the Material UI table

I have been using the Table component provided by the material-ui library in my React project. However, I have encountered an issue where each row, including the header, has a padding of 24px on the top and bottom that I am unable to modify or overwrite. D ...

I am having difficulty combining 2 HTML pages without the output becoming distorted

Having encountered issues when combining two HTML pages, one for a navbar and the other for a contact form in my Django project. The resultant single page appears distorted as shown in the image below. I attempted to use sections but it does not seem to re ...

Utilize various CSS styles for text wrapping

I'm struggling to figure out where to begin with this problem. My goal is to create a three-column row that can wrap below each other if they cannot fit horizontally. The height of the row should adjust to accommodate the items while maintaining a fix ...

Text is not visible when hovering over it

I am facing an issue with the hover effect on my menu element. When I hover over the element, the text does not appear as expected. Even after using z-index to position the text on top, it still doesn't work. Here is a snippet of my code: HTML: < ...

Guidelines for transmitting form information to a web API using Angular

I am currently working on an Angular 6 project where I have a form and a table that retrieves data from a web API. I want to know if it's possible to send the form data to that web API. Here is the code snippet that I have so far: HTML Form: &l ...

Internet Explorer is automatically inserting extra vertical space after the first list item in a basic menu design

Does anyone else have trouble with IE? (Or is it just me?) I'm creating a list with a background. The first and last LI elements are 5px high, while the others are 16px high. However, in IE there's a strange blank space between the first and se ...

The sidebar.querySelector method is not working as expected

Attempting to assign an 'active' class to the clicked 'nav-link' element in order for it to stay active on the next page the user navigates to. Encountering an issue with sidebar.getElementsByClassName is not a function showing up in t ...

Ensuring the same height for two p-cards in PrimeNG

I am facing an issue with ensuring both p-card elements have the same height, where the smaller one aligns to the height of the bigger one. https://i.sstatic.net/Mfnlr.png Is there a way to achieve this using the code below: parent.component.html <di ...

Firefox experiencing problem with retrieving video.duration in HTML5

I am currently working on developing a unique video player from scratch. <video preload="metadata" id="videoPlayer" style="width: 640px; height: 360px;"> </video> <script type="text/javascript"> var v = ""; var myV ...

The sticky top feature of the Bootstrap 4 navbar does not function properly when it is nested inside a div

I am just getting started as a beginner working on a Web application and utilizing Bootstrap 4 for my web design. I have a quick question that needs some clarification. When the code is structured like this, the Navbar does not stay fixed at the top: < ...

Changing the CSS of ng-view when triggering CSS in ng-include: A step-by-step guide

Incorporating my left-hand, vertical navbar into the page using ng-include, I've managed to make it expand right on hover. Each page is enclosed within a <div class="wrapper">. My goal is to adjust the margin of each wrapper as the navbar expan ...

The issue with the <Button> component not properly linking in next.js

Having trouble with a button wrapped inside a custom Navbar component. The code snippet in question is: <NavBtn> <Link href="/contact" passHref> <Button> Contact Me </Button> </Link> & ...

A set of four responsive divs arranged vertically

Confession time... I'm facing a challenge with this task... I'm attempting to create a responsive page with 4 stacked divs. Here are the guidelines for each div: The header div: The text should be at the bottom, serving as a slogan placed clo ...

What is causing the navigation bar object to not adhere to the CSS rules?

My presentation for the MVP is outlined below: .navbar { flex-direction: row; } <!DOCTYPE html> <html lang="en" dir="ltr> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="h ...

Discover the size of an image using JavaScript by accessing innerHTML

I'm currently working on a unique AJAX function that retrieves image URLs without using node append for insertion. Instead, I opted to utilize innerHTML, but this has posed challenges in accurately obtaining the file dimensions. My current approach i ...

What measures can be taken to stop LESS partials from compiling independently?

When working with LESS, I utilize partials that are included (@include) into the main LESS stylesheet. A common issue I face is that each partial ends up compiling to its own CSS file, leading to project clutter. In SASS, if a file is named with an unders ...

Utilizing Python's urllib and urllib2 to automatically populate web forms

My goal is to automatically submit an HTML form using both urllib2 and urllib. import urllib import urllib2 url = 'site.com/registration.php' values = {'password' : 'password', 'username': 'username& ...

Tips for inserting an image within a horizontal list of items

Struggling to find a solution here. I have a menu with a unique bar design between list elements, featuring breaks at the top and bottom. I attempted to use li:after in the CSS to insert an image, but encountered issues with padding and margin. Below is t ...

Utilizing React Bootstrap with TypeScript for Styling Active NavItem with Inline CSS

Is it possible to change the background color of the active NavItem element to green using inline CSS in React Bootstrap and React Router Dom? I am currently using TypeScript 2.2 and React. If not, should I create a CSS class instead? Here is the code sni ...

Having trouble with installing create-react-app for my_app using npm because it seems to be stuck on f

I've hit a roadblock while trying to create a react app on my 2011 MacBook Pro. To start, I downloaded the latest version of Node from their official website. Following the instructions from React documentation, I ran the following commands: npm uni ...