How does the horizontal alignment button send?
How do I get this search button to align horizontally horizontally?
+3
TriggeredNope
source
to share
3 answers
The inputs are styled by default display:inline;
, which means the parent must have the text-align:center;
following:
.parent {
background-color: #404040;
text-align: center;
padding: 5px;
}
<div class="parent">
<input type="submit" class="submit" value="Submit">
</div>
Or alternatively, you can change the display type of the button / input to display:block;
and use automatic fields like this:
.parent {
background-color: #404040;
padding: 5px;
}
.submit {
display:block;
width: 100px; /* note that display block will go full width unless you specify otherwise */
text-align:center;
margin: auto;
}
<div class="parent">
<input type="submit" class="submit" value="Submit">
</div>
+1
Frits
source
to share
This is what you need?
.full-width {
text-align:center;
width:100%;
float:left;
background:#404040;
padding:5px;
}
<div class="full-width">
<input type="button" value="search" />
</div>
+1
Jishnu VS
source
to share
0
Tomer Wolberg
source
to share