css form- input/textarea styling & positioning.. code & image included - css

I'm new to web design, so please forgive if this is super simple- I've tried everything I know and can't quite seem to get this right.
I've put together a contact form using html & css. Ideally, I'd like to have a 1px line extending from each label to use as an input guide. This line should be level with the bottom of the label. I'd also like a series of lines extending vertically in the text area to allow for extra writing space.
Currently, the input lines for Name and Email aren't showing, and there is only one line at the very bottom of the textarea for Message.
Here's the code I'm working with:
<div id="contact-form">
<div id="invite">
<h1>Let's Talk.</h1>
<div class="postinfo">
<h2>Have you got a project needing an eye for detail and a creative touch? I'd love to hear from you.</h2>
</div><!-- end postinfo -->
</div><!-- end invite -->
<form>
<label for="user">Name:</label>
<input type="text" name="user" value="" /><br />
<label for="emailaddress">Email:</label>
<input type="text" name="emailaddress" value="" /><br />
<label for="comments">Message:</label>
<textarea name="comments"></textarea><br />
<input type="submit" name="submitbutton" id="submitbutton" value="Submit" />
</form>
</div><!-- end contact -->
#contact-form {
float: left;
margin-left: 300px;
margin-top: 310px;
}
#invite .postinfo {
list-style-type: none;
width: 150px;
}
label {
float: left;
font-family: dalle;
font-size: 160%;
letter-spacing: 2px;
text-transform: uppercase;
margin-left: 200px;
margin-top: -105px;
width: 120px;
}
input, textarea {
border-style: none;
border-bottom: 1px solid #202020;
margin-bottom: 5px;
margin-left: 300px;
margin-top: -105px;
width: 245px;
}
textarea {
width: 250px;
height: 150px;
}
#submitbutton {
background: none;
border-style: none;
font-family: Georgia,
Constantia,
"Lucida Bright",
"Bitstream Vera Serif",
"Liberation Serif",
serif;
margin-left: 173px;
margin-top: 5px;
width: 90px;
}
br {
clear: left;
}
Ideal outcome:

Based on your code i create a fiddle see below. If any changes or other requirement please clarify.
Fiddle: http://jsfiddle.net/EaKmZ/
Demo: http://jsfiddle.net/EaKmZ/embedded/result/
Note: I have not edited your code too much so many un necessary css are present and not required.

There were some unneeded CSS rules on your codes. Try this demo to see it fixed to some extent but lines on text area cannot be achieved using CSS.
You need to use image for that. See a demo

Related

Missing images in an html file

The following HTML code:
<div class="main-container">
<div id="top-section-main">
<div id="top-section-content">
<h1>Awesome looks so good</h1>
<p>Awesome is the landing page you wish you had when you started</p>
<p class="playBTN"><img src="Images/9.1 Play.png" height="120px" width="120px"></p>
<div class="main-form">
<form>
<h6>SIGN UP FOR A FREE 30 DAY TRIAL</h6>
<input type="text" name="name" placeholder="Name">
<input type="email" name="email" placeholder="Email">
<button style="trial" type="submit" value="submit">Start Free Trial</button>
</form>
</div>
</div>
</div>
</div>
And it's corresponding CSS:
#top-section-main{
background-image: url(/Images/6.1\ Friends.jpg);
height: 740px;
border: none;
}
#top-section-content{
width: 60%;
margin-left: auto;
margin-right: auto;
margin-top: 0;
}
#top-section-content h1{
font-size: 4em;
font-weight: 300;
color: #ffffff;
text-align: center;
margin: 0;
padding-top: 100px;
}
#top-section-content p{
font-size: 1.3em;
font-weight: 400;
color: #ffffff;
text-align: center;
margin-top: 10px;
}
.playBTN{
text-align: center;
margin: auto;
padding: 50px 0 100px 0;
}
.main-form h6{
font-family: sans-serif;
font-size: 0.9em;
font-weight: 100;
color: #ffffff;
text-align: center;
}
.main-form input{
width: 30%;
margin: 0;
height: 40px;
font-family: sans-serif;
font-size: 15px;
padding-left: 15px;
font-weight: 100;
border: none;
}
.main-form button{
width: 30%;
height: 42px;
font-family: sans-serif;
font-size: 15px;
padding-left: 15px;
font-weight: 100;
background-color: #6dc77a;
color: #ffffff;
border: none;
}
This is a problem regarding a static webpage that I created. When this is launched via the IDE itself (VScode), there is no issue and every image is being displayed. But when I open the html file separately from the folder, few images are missing. I've checked the path of the pictures and it looks good (note - all the images are present within the folder) . Any idea on what may have gone wrong?
few images are missing
Which ones are displayed and which ones are missing? Please be more specific when reporting a bug.
Where's your stylesheet relative to your HTML page? No <link> in your code so wWe don't have that information.
(I don't know how VSCode differs from a regular browser) Assuming the img element in your HTML code is displayed, your background-image should looks like background-image: url("/Images/6.1 Friends.jpg");. Try removing the trailing slash if it still doesn't display.
If your stylesheet isn't in the same directory than your markup, then you still may have a problem: that trailing slash s the root of your files which is a known location with a webserver (protocol http(s):// in your browser) but is the root of the filesystem of your OS with file:/// protocol.
More general note: when relative, path of CSS ressources is relative to the location of that CSS, not relative to your HTML page.
OT: alt attribute is mandatory for <img> elements. It should be alt="" for decorative images and alt="something meaningful" for images bringing information (see WAI tutorial for more information)

Limiting utilized area within textbox using CSS

I have a small image placed within the right side of my text box and I am trying to prevent my text from running behind that image. However, I do not want to limit the amount of characters by doing this. Any suggestions?
<div id="searchContainer">
<!--Search Bar-->
<input id="searchBar" type="text" placeholder="Type here to search" onfocus="placeholder = ' '"/>
<!--Microphone-->
<img id="mic" src="*Super long URL*"/>
</div>
/*Search Bar*/
#searchBar {
opacity: 0.6;
position: relative;
display: block;
height: 24px;
font-size: 16px;
font-family: Arial, sans-serif;
width: 550px;
}
What people typically do is put the text input, and image inside of a container. They remove the border of the input so it appears to be a white input box. They stylize the container with a border and such to make it look like THAT is the input. Then they put the (in your case) microphone image floated to the right, and add a margin right to the input. so the text does not hide behind the image.
Here is the basic idea: http://codepen.io/anon/pen/pJdMJB
HTML:
<div id="searchContainer">
<img src="http://i.imgur.com/w5j4E5O.png"/>
<input id="searchBar" type="text"/>
</div>
CSS:
#searchBar {
opacity: 0.6;
position: relative;
display: block;
height: 24px;
font-size: 16px;
font-family: Arial, sans-serif;
width: 500px;
border:none;
}
#searchContainer{
border:1px solid #ddd;
width:520px;
}
img{
width:20px;
height:20px;
float:right;
}

css aligning menu to the right

This is probably a simple one, but I can't seem to figure it out for the life of me. I'm making a mobile menu and I'm trying to make it sit to the right of the screen. (the search bar and the menu icon)
My problem is that if I float it to the right, the background disappears and if I text-align it the text-indent I have on a link decides to show up.
My html
<div id="subHeader">
<ul class="mobileMenu">
<li>
<form>
<input type="text" name="search" id="search" />
<input type="submit" value="Search" class="sub" />
</form>
</li>
<li class="menLink">MobileMenu</li>
</ul>
</div>
and an example can be seen over here at jsfiddle
http://jsfiddle.net/zazvorniki/9SWbs/1/
Some help would be much appreciated!
I achieved the layout you are after by adding width :100% and float: right to #subHeader. I also added float: right to .mobileMenu li and removed the margin attributes of .menlink. Please see below changes and jsfiddle...
#subHeader{
background: #c1c1ab;
width: 100%;
color: #1a1a15;
float: right;
}
.mobileMenu li{
display: inline-block;
float: right;
font: bold 1.2em/1.5em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
margin-right: 4px;
}
.menLink {
background:url("http://tinyurl.com/kgd7ayt") no-repeat;
height: 3em;
width: 3em;
}
.menLink a {
text-indent:-9999px;
display:block;
height: 3em;
width: 3em;
}
jsfiddle demo

Dynamically assign values in CSS

Is it possible to position a link or text dynamically based on the content present above.
For example, I have a page as follows:
Dashboard.xhtml
<div id="innerContainer">
<p:dataTable id = "adminDataTbl" value="#{userAdminMB.userRoles}" var="userList" selectionMode="single" selection="#{userAdminMB.selectedUser}" rowKey="#{userList.ntId}" styleClasses="order-table,table" headerClass="order-table-header" rowClasses="order-table-odd-row,order-table-even-row" >
<p:column styleClass="table-data">
#{userList.ntId}
</p:column>
<p:column styleClass="table-data">
#{userList.roleList}
</p:column>
</p:dataTable>
</div>
<div id="userLink">
<h:commandLink action="#{userAdminMB.addUser}">
<h:outputText value="Add a User to the Admin Tool"/>
</h:commandLink>
</div>
styles.css
#outerContainer{
width: 100%;
height: 500px;
top: 150px;
border: 1px thin;
}
#innerContainer{
width:100%;
height:400px;
text-align: right;
margin-right: 9px;
font-family: Arial;
font-size: 16px;
border: 1px thin;
}
#addUserLink{
font-family: Arial;
font-size: 16px;
float: left;
top: 550px;
position: inherit;
}
.editUserLink-data{
font-family: Arial;
font-size: 16px;
float: right;
top: 175px;
}
The data in <p:dataTable> may be different based on the DB hit that is made. I need the addUser link to be positioned accordingly.
Please help. Any help will be much appreciated.
If I am understanding you correctly then what you want to do is:
<div sytle="textalign: right" id="firstLink">Link1</div>
<div id="dynamicContent">
dynamic content here
</div>
<div id="link2">Link2</div>
If you want to add relative positioning between the dynamicContent and link2 divs you can do so.
Using the above code the link two will fall below the dynamic content on your page

Center input type text inside a form inside div inside a wordpress page?

I've created a simple get method form and am having trouble centering the input box. The code works fine out of wordpress, but when I insert into a wordpress page, the input box becomes mis-aligned.
Here's the code I'm inserting on the wordpress page.
<div class="homebox">
<form method="get" action="/home-quote-page.html" form name="quote" rel="nofollow" onsubmit="return ray.ajax()">
<p class="topquotetext">Enter your zip code:</p>
<p><input name="zipcode" class="zipbox" type="text" value="" size="5" maxlength="5"/> </p>
<p><div style="getquote"><input type="image" src="/Photos/startquote.gif" alt="Start Your Quote" name="go" value='Submit'/></div></form></p>
<div id="load" style="display:none;">Finding...Please wait.</div>
</div>
Here's the css. Everything works fine except .zipbox it will allow me to change the color of the box and the height but that's it. No matter what number I input into the width of the box it stays the same width, it also doesn't center inside the div.
.homebox {
text-align: center;
width: 300px;
height: 268px;
background: #2872bd url(/Photos/home-insurance-box.jpg) no- repeat; }
.topquotetext {
font-family: sans-serif, Arial, Verdana;
font-size:16px;
color:#ffffff;
padding-top:70px;
text-align: center;
}
.zipbox {
width: 95px;
height: 25px;
text-align: center;
font-size: 24px;
margin-right: 10px;
margin-left: 10px;
margin-top: 5px;
border: #7F9DB9 1px solid;
background-color: #FFFED2;
}
.getquote {
width: 300px;
text-align: center;
}
Are you pasting this into the default WYSIWYG in WP? If so, WP is stripping out some of your markup. Find a plugin that will allow you to paste in markup, or create a new template and hard-code this section.
Of course it would be centered if you use margin-left: 10px; on the .zipbox and text-align: center would not make element centerd, just text which will be centered. There's nothing wrong with WordPress, it's just how you style the element.
Try this, a bit change of your stylesheet.
.zipbox {
width: 95px;
height: 25px;
display: block;
overflow: hidden;
clear: both;
margin-top: 5px;
margin-left: auto;
margin-right: auto;
font-size: 24px;
border: #7F9DB9 1px solid;
background-color: #FFFED2;
}
And also make sure that the parent element style not affecting the .zipbox and you don't need to wrap the <input /> element in <p></p>, wrap it with <div></div> instead.

Resources