I have an input form that’s meant to capture twitter handles. I simply want to center the input and submit buttons in the center of the page, but for some reason I can’t get it to work with me. Here’s the relevant snippet of CSS/HTML (also note, I’m using Bootstrap & ASP.NET)
<form asp-action="GetTwitterHandle">
<div class="submitView">
<input name="UserHandle" class="form-control" placeholder='@Example_User'/>
<input type="submit" class="btn btn-primary" value="Get Stats" />
</div>
</form>
.submitView {
border: 1px solid orange;
height: auto;
display: flex;
justify-content: center;
align-items: center;
width: 50%;
}
2
Answers
If you want something like this… remove width: 50% and add height: 100vh;
If it’s not helping, let me know by commenting.
set
height: 100vh;
in the submitView class. it will align the item horizontally and vertically.