I don't know what else to do. I am a newbie and doing what I thought was
simple coding. I have tried everything including display:inline and
display:inline important;". I am trying to put the submit button on the
same line with the same style attributes (blue, white words, etc.).
Please help!
<form action="/action_page.php">
<input type="textarea" name="firstname" placeholder="Enter your address
to determine if we buy in your neighborhood" style=
"border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top: 1px solid #d6d4d4;
border-right: 1px solid #d6d4d4;
border-bottom: 1px solid #d6d4d4;
border-left: 1px solid #d6d4d4;
height: 52px;
width: 618px;
padding-top: 15px;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 5px;
color: #161616;
line-height: 1.1;
box-sizing: border-box;
font-family: open sans;
font-weight: 400;
text-align: left;
text-align-last: left;
font-size: 16px;
background-color: #fff;
background-image: none;
overflow: hidden;
box-shadow: 0 0 0 rgba(0,0,0,.5);">
<input type="submit" value="Get Started" style="font-weight: 400; line-
height: 3.1;
font-size: 13px;
color: #ffffff;
background-color: #12208e;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left: 0;
height: 50px;
width: 160px;
padding-top: 0;
padding-right: 14px;
padding-bottom: 0;
padding-left: 14px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 5px;
color: #fff;
line-height: 1;
box-sizing: border-box;
font-family: open sans;
font-weight: 700;
text-align: center;
text-align-last: center;
font-size: 20px;
background-color: #12208e;
background-image: none;
overflow: hidden;
text-shadow: 1px 1px 1px #000;">
</form>
There are quite a few things that are causing errors with your code. First of all, to get your desired layout add in a div that wraps around the two input elements like so:
<div class="form-row">
<input type="textarea" name="firstname" placeholder="Enter your address to determine if we buy in your neighborhood" class="name-input">
<input type="submit" value="Get Started" class="btn-submit">
</div>
Apply these styles to that div to make the two input elements appear "on one-line":
.form-row {
display: flex;
flex-direction: row;
width: 100%;
font-weight: 400;
}
You also had a spelling mistake in the styles for your button, where you had line- height: 3.1;, however I removed that line as you were overriding it with another line-height rule further down.
html {
font-family: open sans;
}
.form-row {
display: flex;
flex-direction: row;
width: 100%;
font-weight: 400;
}
.name-input {
border-radius: 4px;
border: 1px solid #d6d4d4;
height: 52px;
width: 618px;
padding: 15px;
margin: 5px;
color: #161616;
line-height: 1.1;
box-sizing: border-box;
font-family: open sans;
text-align: left;
font-size: 16px;
background-color: #fff;
box-shadow: 0 0 0 rgba(0, 0, 0, .5);
}
.btn-submit {
color: #ffffff;
background-color: #12208e;
border-radius: 5px;
border: 0;
height: 50px;
width: 160px;
padding: 0 14px;
margin: 5px;
color: #fff;
line-height: 1;
box-sizing: border-box;
font-weight: 700;
text-align: center;
font-size: 20px;
text-shadow: 1px 1px 1px #000;
}
<form action="/action_page.php">
<div class="form-row">
<input type="textarea" name="firstname" placeholder="Enter your address to determine if we buy in your neighborhood" class="name-input">
<input type="submit" value="Get Started" class="btn-submit">
</div>
</form>
Note: Since you are setting a fixed width on those two elements, they won't fit on one line on very small screens, or if other elements are added to it.
I greatly recommend splitting your CSS into a separate CSS file like in this snippet. It will allow you to better see what is going on. Also if you use a decent IDE (code editor) it will pick up these errors for you as well.
Here are some resources you can use to learn more about CSS and HTML. Good luck!
Related
We are using AutoCompleteExtender in our project and when checking in IE we don't see the full list but just first element. However, same site works just fine in Edge/Chrome. I did poking around and found that the list/dropdown is there but its somehow hiding behind and just one item hight of data is visible. here is how it looks.
IE:
Edge/Chrome:
IE when using element highligher :
Server side code
<ajaxTK:AutoCompleteExtender ID="AutoCompleteExtenderGoToOrder"
TargetControlID="txtGlobalOrderKeywords"
runat="server"
MinimumPrefixLength="3"
CompletionInterval="500"
CompletionSetCount="20"
ServicePath="~/services/dataAjax.asmx"
ServiceMethod="GetGoToOrderList"
UseContextKey="true"
OnClientItemSelected="extenderOrderSelected"
CompletionListCssClass="autocompletegotoorder_completionListElement"
CompletionListItemCssClass="autocompletegotoorder_listItem"
CompletionListHighlightedItemCssClass="autocompletegotoorder_highlightedListItem"
/>
HTML
<DIV id=Header1_divGotoOrder class=gotoOrder>
<SPAN id=Header1_lblGlobalGoToOrder class=topicHeader style="COLOR: white">Order:</SPAN>
<INPUT id=Header1_hdnGlobalOrderID type=hidden name=Header1$hdnGlobalOrderID>
<INPUT id=Header1_txtGlobalOrderKeywords style="WIDTH: 50%" value=metr name=Header1$txtGlobalOrderKeywords autocomplete="off">
<UL id=Header1_AutoCompleteExtenderGoToOrder_completionListElem class=autocompletegotoorder_completionListElement style="WIDTH: 463px; POSITION: absolute; LEFT: 1405px; Z-INDEX: 1000; DISPLAY: none; TOP: 30px; VISIBILITY: hidden"></UL>
</DIV>
CSS
.autocompletegotoorder_completionListElement
{
padding-bottom: 0px;
padding-top: 0px;
padding-right: 0px;
padding-left: 0px;
position: absolute;
z-index: 9999 !important;
visibility: hidden;
margin-left: -1px !important;
margin-top: 0px !important;
background-color: #F1F0F0;
color: windowtext;
border: buttonshadow;
border-color: Black;
border-width: 1px;
border-style: solid;
cursor: 'default';
overflow: auto;
height: 200px;
text-align: left;
list-style-type: none;
}
/* AutoComplete highlighted item */
.autocompletegotoorder_highlightedListItem
{
list-style-type: none;
font-family: Tahoma;
font-size: 11px;
color: White;
text-decoration: none;
background-color: Navy;
cursor: pointer;
cursor: hand;
padding: 0px 0px 0px 3px;
margin: 0px;
text-align: left;
line-height: 20px !important;
}
/* AutoComplete item */
.autocompletegotoorder_listItem
{
line-height: 20px !important;
background-color: #F1F0F0;
padding: 0px 0px 0px 3px;
margin: 0px;
font-family: Tahoma;
font-size: 11px;
color: black;
cursor: default;
text-decoration: none;
text-align: left;
}
I'm trying to resize the font to the container, to be kept in a single line not matter how long is, just by resizing it's font.
this is what I'm talking about
#project_stats{
padding: 0;
width: 320px;
margin: 0;
border-right: 1px solid #ccc;
pr1 {
font-size: 2vw; overflow: hidden;
letter-spacing: -1px;
font-weight: normal;
padding: 0px;
margin: 0px;
color: black;
}
}
Any ideas?
---- EDIT 1 ------
Html.
<% provide(:title, #project.name) %>
<div class="row">
<div class="col-md-12" id="project_canvas">
<div class="row">
<div class = "col-md-3" id="project_stats">
<pr1><%= #project.name %></pr1>
........
Update to CSS
#project_canvas{
background: white;
width: 1600px;
margin-left: auto;
margin-right: auto;
margin-bottom: auto;
border-radius: 10px;
padding: 30px;
box-shadow: rgb(150,150,150) 5px 5px 10px;
#project_stats{
padding: 0;
width: 320px;
margin: 0;
border-right: 1px solid #ccc;
pr1 {
font-size: 2vw; overflow: hidden;
letter-spacing: -1px;
font-weight: normal;
padding: 0px;
margin: 0px;
color: black;
}
}
}
I want a text-area with black background to be within DIV with white background. Text-area should not fill the complete DIV so the DIV's white color is still seen around text-area. DIV itself should occupy only 80% of the screen's width (or browser's tab). The problem is that the DIV's white background ain't seen around text-area.
.mydiv {
vertical-align: middle;
width: 80%;
text-align: left;
padding-top: 10px;
padding-left: 20px;
padding-right: 20px;
background: white;
}
.mytextarea {
height: 100px;
width: 100%;
position: relative;
padding: 2px 2px;
font-size: 12px;
font-weight: bold;
float: left;
border-radius: 10px;
font-family: 'Helvetica', cursive;
color: white;
text-decoration: none;
background-color: black;
border-bottom: 4px solid #2980B9;
border: 2px solid blue;
outline: 0;
}
You can use display:inline-block; instead of float:left;
.mytextarea {
height: 100px;
width: 100%;
position: relative;
padding: 2px 2px;
font-size: 12px;
font-weight: bold;
display: inline-block;
border-radius: 10px;
font-family: 'Helvetica', cursive;
color: white;
text-decoration: none;
background-color: black;
border-bottom: 4px solid #2980B9;
border: 2px solid blue;
outline: 0;
}
Jsfiddle
.mydiv {
vertical-align: middle;
width: 80%;
text-align: left;
padding-top: 10px;
padding-left: 20px;
padding-right: 20px;
background: red;
}
.mytextarea {
height: 100px;
width: 100%;
position: relative;
padding: 2px 2px;
font-size: 12px;
font-weight: bold;
display: inline-block;
border-radius: 10px;
font-family: 'Helvetica', cursive;
color: white;
text-decoration: none;
background-color: black;
border-bottom: 4px solid #2980B9;
border: 2px solid blue;
outline: 0;
}
<div class="mydiv">
<textarea class="mytextarea"></textarea>
</div>
You can visit the site I am trying to work on here.
I am trying to get basically the layout as in the top right box in the bottom right box, but for some reason I cannot get it to float to the right. Is there something I am missing here? It's driving me nuts because my code works in the upper box but not in the lower one.
Here's the HTML.
<div id="menu-ad">
<div>
<p class="titles">Our Fare</p>
<p id="ad">Our lunch and dinner menus feature European inspired comfort food accompanied by an extensive bar.</p>
VIEW MENU
</div>
</div><!--end menu ad-->
<div id="hours">
<div>
</div>
</div><!--end hours-->
</div><!--end container-->
And the CSS.
/*menu ad*/
div#menu-ad {
position: relative;
margin-right: -11px;
margin-top: -11px;
width: 268px;
height: auto;
float: right;
padding: 11px 11px 10px 10px;
border-left: 2px solid #b9aea3;
border-bottom: 2px solid #b9aea3;
overflow: hidden;
}
div#menu-ad div {
background: #f9f4df;
padding: 1.9rem 4rem 2.5rem 2.5rem;
height: 200px;
display: inline-block;
}
.titles {
font-family: "Montserrat", "Helvetica", sans-serif;
font-size: 2.5rem;
color: #d6832e;
}
#ad {
font-family: "Montserrat", "Helvetica", sans-serif;
font-size: 1.6rem;
line-height: 1.35;
color: #4f4d4b;
margin-top: .5rem;
width: auto;
}
a#button {
padding: .6rem 1.3rem .6rem 1.3rem;
font-family: "Montserrat", "Helvetica", sans-serif;
font-size: 1.8rem;
color: #fff;
background: #d6832e;
text-align: center;
vertical-align: middle;
text-decoration: none;
position: absolute;
float: left;
bottom: 3.5rem;
}
/*hours*/
div#hours {
position: relative;
margin-right: -11px;
margin-top: 11px;
width: 268px;
height: auto;
float: right;
padding: 11px 11px 10px 10p;
border-left: 2px solid #b9aea3;
}
div#hours div {
background: #f9f4df;
padding: 1.9rem 4rem 2.5rem 2.5rem;
height: 150px;
display: inline-block;
}
Thanks for any help! It's probably something simple and I just need a fresh pair of eyes.
you seem to have a typo,
under the style rule for
div#hours
you have
padding: 11px 11px 10px 10p;
your missing an 'x' at the end. Which means the padding rule is not being applied
Now this solves the alignment, but the height might not be right now, but I'm sure that should be straight forward
I'm trying to position a searchbox and submit button so that they are line up. I've used a CSS reset to have all browsers starting from the same level. For whatever reason, I can't get them to line up on the IE, Chrome and Firefox. I can get it working on 1/3 but not 3/3. With the current code, the search button is aligned in FF, 1px lower in IE, and 3-5px lower in Chrome. Any help is much appreciate as I am at my wits end.
Here's the code.
HTML snippet:
<span class="search">
<form id="searchbox" action="/search" method="get">
<input name="query" id="search" type="text" placeholder="I'm looking for..."/>
<input id="submit" class="mglass" type="submit" value=""/>
</form>
</span>
CSS snippet:
* {
vertical-align: baseline;
font-weight: inherit;
font-family: inherit;
font-style: inherit;
font-size: 100%;
border: 0 none;
outline: 0;
padding: 0;
margin: 0;
}
#search{
position: relative;
bottom: 1px;
height: 27px;
width: 200px;
font-size: 14px;
font-family: 'calibri', Tahoma, Geneva, sans-serif;
border: none;
background-color: #eee;
border-width: 1px;
border-style: solid;
border-color: #cccccc;
padding-left: 10px;
}
#searchbox{
position: relative;
right: 27px;
top: 5px;
float: right;
}
input[type="submit"]::-moz-focus-inner {
border: 0;
padding: 0;
}
input[type="text"]::-moz-focus-inner {
border: 0;
padding: 0;
}
.mglass{
background: url(../images/search_glass01.png) no-repeat center;
height: 29px;
width: 33px;
border-width: 1px;
border-style: solid;
border-color: #cccccc;
position: relative;
right: 7px;
bottom: 0px;
}
.mglass:hover{
background: url(../images/search_glass02.png) no-repeat center;
}
I had to hack up your CSS a bit and simplified some of the selectors to get my head around it, but, give this a try:
http://jsfiddle.net/R56mu/
body {
vertical-align: baseline;
font-weight: inherit;
font-family: inherit;
font-style: inherit;
font-size: 100%;
border: 0 none;
outline: 0;
padding: 0;
margin: 0;
}
#searchbox{
float: right;
overflow:hidden;
}
#search{
width: 200px;
height:32px;
float:left;
padding: 0 0 0 10px;
background-color: #eee;
font-size: 14px;
font-family: 'calibri', Tahoma, Geneva, sans-serif;
border: none;
border-width: 1px;
border-style: solid;
border-color: #cccccc;
}
#submit{
width: 33px;
height:34px;
float:left;
background: url(../images/search_glass01.png) no-repeat center;
border-width: 1px;
border-style: solid;
border-color: #cccccc;
}
#submit:hover{
background: url(../images/search_glass02.png) no-repeat center;
}
input[type="submit"]::-moz-focus-inner {
border: 0;
padding: 0;
}
input[type="text"]::-moz-focus-inner {
border: 0;
padding: 0;
}