-1

I have the follwoing code:

<div class="container mt-5 text-center">
    <form method="POST" action="{{ url_for('view') }}" enctype="multipart/form-data">
        <div class="form-group">
            <label for="file">Choose file:</label>
            <input type="file" class="form-control-file file-input" name="file" id="file">
        </div>

        <button type="button" class="btn btn-primary" onclick="confirmAction()">Upload</button>
        <a href="{{ url_for('upload') }}" class="btn btn-secondary">Cancel</a>
    </form>
</div>

I'm trying to center it on the page and the problem is that the file input cannot be centered. The buttons and the labels were centered, but the input remains of the left side of the page. Do you have any suggestions?

WillUpdate
  • 53
  • 6

1 Answers1

-1

Add this style tag ahead of div tag,

<style>
    .centered-form {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
</style>

By applying this, the form elements, including the file input, should be centered on the page. Adjust the styling as needed to match your desired layout.