html - Align Elements Left Within Centered Div Container -
i looking align elements left within centered div container. issue finding used text-align
center overall div, when try create content container , text-align
left isn't lining content left within centered div.
html:
<div id="bar-fields"> <h1><u>bar information</u></h1> <label>logo:</label> <input type="button" value="upload"> <br /> business name: <%= f.text_field :name, required: true %> <br /> <div id="bar-description-field"> <label>description:</label> <%= f.text_area :description %> </div> <br /> zip: <%= f.text_field :zip %> <br /> <label>state:</label> <select> <option value="state">state</option> </select> <br /> <label>region:</label> <select> <option>all</option> </select> <br /> phone: <%= f.text_field :phone %> <br /> facebook: <%= f.text_field :facebook %> <br /> twitter: <%= f.text_field :twitter %> <br /> monday specials: <%= f.text_field :mon_special %> <br /> tuesday specials: <%= f.text_field :tue_special %> <br /> wednesday specials: <%= f.text_field :wed_special %> <br /> thursday specials: <%= f.text_field :thu_special %> <br /> friday specials: <%= f.text_field :fri_special %> <br /> saturday specials: <%= f.text_field :sat_special %> <br /> sunday specials: <%= f.text_field :sun_special %> <br /> <%= f.submit "create bar", class: 'submit', id: 'black-submit' %> <% end %> </div>
css:
#bar-fields { text-align: center; } #bar-description-field textarea { height: 100px; width: 250px; vertical-align: middle; } #bar-fields input[type="button"] { margin-bottom: 20px; } #bar-fields input[type=text] { font-size: 27px; margin-bottom: 20px; } #bar-fields select { margin-bottom: 20px; }
you can use center div:
#bar-fields { width: 50%; margin: 0 auto; }
then use text-align:left
wherever need to
read more here: how horizontally center <div> in <div>?
Comments
Post a Comment