Best practices for aligning the widths of input-group-addon elements

Hey there, I'm working with an HTML file that has 3 input options. Here's a snippet:

<script type="text/ng-template" id="dashboard_assigngroup_popup.html">

    <div class="modal-header modal-header2">
        <h3 class="modal-title">Assign Chart Group</h3>
    </div>

    <div class="modal-body">
        <table class="table">
            {%verbatim %}

            <tr>
                <td>
                    <div class="input-group" style="padding:1%;">
                        <span class="input-group-addon">Chart title</span>
                        <select type="input" class="form-control" ng-model="final_data.info" ng-options="m.id as m.title for m in chartlist" required ng-cloak>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="input-group" style="padding:1%;">
                        <span class="input-group-addon">Chart group</span>
                        <select type="input"class="form-control"ng-model="final_data.group"ng-options="c.id as c.name for c in chartgrouplist"required ng-cloak>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="5">
                    <div class="input-group" style="padding:1%;">
                        <span class="input-group-addon">Order </span>
                        <input type="input" class="form-control" placeholder="Order" ng-model="final_data.orderg">
                    </div>
                </td>
            </tr>

            <tr>
                <td colspan="4">
                    <div class="modal-footer">
                        <button class="btn btn-success" type="button" ng-click="submit()" id="submit">Save</button>
                        <button class="btn btn-grey" type="button" ng-click="cancel()">Discard</button>
                    </div>
        </table>
        {% endverbatim %}
    </div>

</script>

The input-group-addons are not aligned properly. I tried to use CSS to align them but was unsuccessful. Any suggestions on how to align these input-group-addons correctly? Thanks!

Answer №1

You can find the solution in your HTML code.

  1. Make sure each label and its parent are within a table cell.
  2. Ensure each input option and its parent are also inside a table cell.

Here is a snippet (add a border to all td elements to see the alignment)

<script type="text/ng-template" id="dashboard_assigngroup_popup.html"></script>
    <div class="modal-header modal-header2">
        <h3 class="modal-title">Assign Chart Group</h3>
    </div>

    <div class="modal-body">
        <table class="table">
            {%verbatim %}

            <tr>
                <td class="input-group" style="padding:1%;">
                <span class="input-group-addon">Chart title</span>
                        
                </td>
                <td>
                <select type="input" class="form-control" ng-model="final_data.info" ng-options="m.id as m.title for m in chartlist" required ng-cloak></select>
                </td>
            </tr>
            <tr>
            <td>
              <span class="input-group-addon">Chart group</span>
              </td>
            <td>
              <select  class="input-group" style="padding:1%;"> </select>
            </td>  
            </tr>
            <tr>
                <td>
                    <div class="input-group" style="padding:1%;"></div>
                        <span class="input-group-addon">Order </span>
                </td>
                <td>
                  <input type="input" class="form-control" placeholder="Order" ng-model="final_data.orderg">
                </td>                
            </tr>

            <tr>
                <td colspan="4">
                    <div class="modal-footer">
                        <button class="btn btn-success" type="button" ng-click="submit()" id="submit">Save</button>
                        <button class="btn btn-grey" type="button" ng-click="cancel()">Discard</button>
                    </div>
        </table>
        {% endverbatim %}

    </div>

</script>

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

What is the best way to configure a metered subscription plan on Stripe that invoices annually but bills extra fees for overage on a monthly basis

I'm in the process of setting up a subscription system on stripe that includes a plan with 5000 monthly credits for a flat $299 yearly fee. My goal is to charge customers who exceed their monthly credit limit by the end of each month. For example, if ...

Vue app: ESLint throwing error for undefined global variable in component during npm run serve

In my main.js file, I am initializing a new Vue instance on the window object: window.todoEventBus = new Vue() Within my components, I am attempting to access this global todoEventBus object like so: created() { todoEventBus.$on('pluralise&apos ...

Are you utilizing Google Chrome extensions for importing and exporting JSON files?

Currently, I am in the process of developing a Google Chrome extension and I have a question regarding its capabilities. Is it possible for the extension to generate JSON files for users to download (export) as well as implementing a button that allows use ...

Tips for composing a hyperlink within a property

I'm a newbie to Vue.js and facing a challenge with assigning a property to a link. I'm unsure of how to write the "counter" variable from "data" in order for it to properly function as intended. export default { name: 'app', data ( ...

exciting, showcasing a dependency map using svg within an html5 environment

I am working on creating a polygon background for my menu, which needs to be responsive in design. Here is an example of what I am trying to achieve: example image. Should I use JavaScript to listen for size changes and adjust the points for the polygon e ...

Arranging content in a horizontal row using div elements

My webpage features two div elements. One of the div represents header content, while the other div displays details content. I want both sets of content to be aligned side by side. Specifically, I need the details content to always appear on the right-han ...

Having trouble with CORS errors persisting despite configuring CORS options for Google Authentication on React/Node/Passport

Currently, I'm in the process of developing a basic application using React for the frontend and Node/Express/MongoDB for the backend. User authentication is being handled through Passport, with local authentication and Google authentication both func ...

What is the technique for causing this element to move in reverse?

How can I utilize JS to halt the interval and direct the alien to move backwards once it reaches 700px? I am aware that CSS can achieve this, but I prefer a strictly JS approach. I am struggling with stopping the interval as it hits the left position of 70 ...

Ways to dynamically implement a JSON configuration file in React JS during runtime

Looking to achieve text and image externalization in React? It's all about making changes in a JSON file that will reflect on your live Single Page Application (SPA). Here's an example of what the JSON file might look like: { "signup. ...

React Native: Avoiding Infinite Loops in useEffect

I am facing an issue where my app goes into an infinite loop because pointsData is inside the useEffect function. How can I resolve this situation? function useGetPoints() { const [pointsData, setPointsData] = useState<PointTbleType[]>([]); ...

Using Regex to detect recurrent (similar) patterns in jQuery <input> tags

I need assistance with ensuring that users input article numbers in the correct format, like this: ABC_ABC123; AB__B2A4; ABF_323WET; ... Currently, I have a regex pattern that works for one article number: var mask1 = /^([A-Z]{2})([A-Z|_]{1})_([A-Z0-9]{ ...

What is the procedure for modifying the height of a button in HTML?

I wanted to add a flashing "Contact Us" button to the menu bar of my website to immediately attract people's attention when they visit. Here is the javascript code I used: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&g ...

Toggle the visibility of the Kendo date calendar container when the input box is clicked

I am currently using a kendo Date picker and it is working perfectly fine. When I click on the icon next to the input box, a date dialog for the calendar opens, which works as expected. However, I would like this dialog to also open when I click directly ...

Combining input streams using node.js and ffmpeg

Currently, I'm in the process of developing a basic and straightforward Video-Web-Chat platform. My approach involves utilizing the getUserMedia API call on the client side to capture webcam data and transmit it as data-blob to my server. My plan is ...

The updating of input and output does not happen instantly; there is a delay before changes

Having an issue with updating input values in React. When using the setState method, the console log does not show the updated input value immediately. For instance, typing "a n" into the input only logs "a" after the second keystroke... Although I under ...

Dynamic water filling effect with SVG

I'm trying to create a wipe animation that looks like water filling up inside of a drop shape. Currently, it is a square with a wave animation on top of the drop logo. The wave animation works correctly, but I am struggling to contain it within the dr ...

Setting initial opacity for CSS on page load

I'm not a pro at web design, but I'm trying to create my own website. I've divided my page into two sections - the left side for the menu bar and the right side for content. To add a 'cool' blur effect over my menu bar, I decided t ...

How can I use a string argument in JavaScript to sort an array of objects by that specific value?

Currently, I am implementing React and facing a challenge with creating a reusable sorting component. This component is meant to sort an array of objects based on a specific property field. For instance, imagine having an array of objects with properties a ...

What is the method for importing styles in Next.js without including the file extension?

I've got a project set up with Next.js, TypeScript, and SCSS. In every app/*/page.tsx or components/*/page.tsx, there's a line importing the stylesheet like import style from "styles/*/index.module.scss". I find these lines to be too lo ...

Windowing box inside a container box

I am looking to implement scrolling for just the "chat-messages" div within the "chat-bar" div on my site. I want only this specific section to be scrollable, while the rest of the site remains stationary. Currently, I have to scroll through the entire pag ...