Positioning input within div - html

I have a div container. Between this div i have another div named model and there is a input file type.
Now when i open up this in my mozilla firefox browser all are looks good. Problem is when i clicked Browse... then it's didn't open to upload a file, but when i clicked outside of Browse... field then it open to upload a file. Here is my html file
input{
margin-bottom: 15px;
padding: 10px;
width: 100%;
box-sizing: border-box;
border-radius: 5px;
height: 50px;
border:0px;
font-family: georgia;
font-size: 12pt;
text-align: center;
}
<div class="container">
<div class="model">
<form>
<div>
<label>Profile Picture</label>
<input type="file" name="img">
</div>
</form>
</div>
</div>
I google it but didn't find any good resource that's helpful for this problem . Sugesstion please . Thank you !

You need to change your CSS code a bit. Try this.
input {
margin-bottom: 15px;
margin-top: 15px;
box-sizing: border-box;
border-radius: 5px;
height: 50px;
border: 0px;
font-family: georgia;
font-size: 12pt;
display: block;
}

As a way to debug the area of the button, you can use the outline attribute.
You set the width: 100%, so it takes the whole line as a block.
Adding the outline attribute and you may see it.
input{
margin-bottom: 15px;
width: 85px;
box-sizing: border-box;
border-radius: 5px;
height: 40px;
border:0px;
font-family: georgia;
font-size: 12pt;
text-align: center;
outline: 1px solid #FF0000;
}
<div class="container">
<div class="model">
<form>
<div>
<label>Profile Picture</label>
<input type="file" name="img">
</div>
</form>
</div>
</div>

Related

getting alignment issue while zoom in zoom out where button position getting moved

i have a form page and it contains few drop-downs, upload and input text fields(for demo i am showing only few elements). i have a change mode button after the attack type dropdown its functionality is not mentioned but while zooming in zoom out that change mode button not maintaining alignment with other elements.
I tried with margin-left in pixes, percentile, and position: absolute, fixed but not working
Please help me with this issue.
This is My HTML Code:
<html>
<head>
<style>
label {
display: inline-block;
margin-left: 30px;
width: 22%;
font-family: Helvetica;
font-weight: bold;
font-size: 12px;
padding: 5px;
}
#attackType {
width: 158px;
border: none;
height: 30px;
background-color: #A9A9A9BF;
border-radius: 2px;
}
#changeCustomPcapModeDiv {
margin-left: 550px;
height: 29px;
margin-top: -29px;
border: none;
border-radius: 3px;
background-color: #A9A9A9BF;
}
#customPcap {
width: 200px !important;
}
.error {
color: red;
}
#attackConfigBtn,
#cancelBtn {
width: 80px;
height: 30px;
padding-top: 4px;
border: none;
background-color: #A9A9A9BF;
border-radius: 3px;
}
#attackConfigBtn {
margin-left: 25%;
font-family: Helvetica;
font-size: 12px;
margin-top: 20px;
margin-bottom: 10px;
}
#cancelBtn {
width: 70px;
margin-left: 3%;
font-family: Helvetica;
font-size: 12px;
margin-top: 20px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div>
<label>Attack Type:</label>
<select name="attackType" id="attackType">
<option value="attack_list">Attack List</option>
<option value="custom_pcap">Custom PCAP</option>
</select>
<button id="changeCustomPcapModeDiv" style="display: block;">Change Mode</button>
</div>
<div style="margin-top: 10px; display: block;" id="customDiv">
<label>Custom PCAP Uplaod: </label>
<input type="file" name="customPcap" id="customPcap" accept=".pcap" data-max-size="102400"><span id="customPcapErr" class="error" style="margin-left:35px;font-size:14px;"></span>
</div>
<input id="attackConfigBtn" type="button" value="Apply" title="Apply new configuration">
<button id="cancelBtn" onclick="window.location = 'index.php'" title="Ignore configurations changes">Cancel</button>
</body>
</html>
and these are the images of my Sample page:
Please help me since i am new to HTML
Thanks

html after <textarea></textarea> appearing in textarea when run in browser. Only happens on Firefox

The following problem only happens in Firefox. The html after my textarea appears in the text box when the page runs in the browser. It works fine on Chrome and Safari. I've cleared my cache but it's still doing it. I can't work out why any code would appear in the box after the closing tag. Screenshot below to better explain the problem.
button {
width: 176px;
height: 47px;
background: #6442ff;
color: #ffffff;
font-family: "Roboto";
font-size: 12px;
line-height: 18px;
align-items: center;
border: none;
}
.home-name {
position: absolute;
width: 828px;
height: 38px;
left: 303px;
top: 4184px;
background: #ffffff;
border: 1px solid #eaeaea;
box-sizing: border-box;
font-family: Roboto;
font-style: normal;
font-weight: normal;
font-size: 15px;
line-height: 25px;
/* identical to box height, or 167% */
text-align: left;
color: #eaeaea;
}
input[type=text] {
padding-left: 20px;
padding-top: 2px;
}
.home-email {
position: absolute;
width: 406px;
height: 38px;
left: 303px;
top: 4236px;
background: #ffffff;
border: 1px solid #eaeaea;
box-sizing: border-box;
font-family: Roboto;
font-style: normal;
font-size: 15px;
line-height: 18px;
/* identical to box height */
color: #d3d3d3;
}
.home-phone {
position: absolute;
width: 406px;
height: 38px;
left: 725px;
top: 4236px;
background: #ffffff;
border: 1px solid #eaeaea;
box-sizing: border-box;
background: #ffffff;
border: 1px solid #eaeaea;
box-sizing: border-box;
font-family: Roboto;
font-style: normal;
font-size: 15px;
line-height: 18px;
/* identical to box height */
color: #d3d3d3;
}
.home-message {
position: absolute;
width: 828px;
height: 167px;
left: 303px;
top: 4288px;
background: #ffffff;
border: 1px solid #eaeaea;
box-sizing: border-box;
font-family: Roboto;
font-style: normal;
font-weight: normal;
font-size: 15px;
line-height: 18px;
;
/* identical to box height */
color: #eaeaea;
}
.home-message-contact {
position: absolute;
width: 163px;
height: 47px;
left: 638px;
top: 4490px;
}
<html>
<head>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght#400;700&display=swap" rel="stylesheet">
<title>Hello</title>
<body>
<form>
<div class="name-form">
<input type="text" placeholder="Name" class="home-name" required>
</div>
<div class="phone-form">
<input type="text" placeholder="Phone" class="home-phone" required>
</div>
<div class="email-form">
<input type="text" placeholder="Email" class="home-email" required>
</div>
<div class="message-form">
<textarea placeholder="Message" class="home-message" required></textarea>
</div>
</form>
<button class="home-message-contact" type="submit">Submit</button>
Looking on your code, you forgot to close </head>. Although it could be unclosed quote, or some script. Your code works fine. You can attach a full code of your file.
UPDATED
I'v recreated your issue. You forgot to close </textarea>
Like this
<textarea placeholder="Message" class="home-message" required></textarea>
This what happens when I removed </textarea>
UPDATE 2
Try to put <button class="home-message-contact" type="submit">Submit</button> inside tag <form>.
Or use construction like this
<div>
<form id="my-form">
<label for="name">Name:</label>
<input type="text" name="name"></input>
</form>
<!-- ... -->
<button type="submit" form="my-form">Submit</button>
</div>
Your question is not clear, however I found same results across browsers.
Closing of head is missing </head> is your html
just change it and refresh on Firefox pressing Shift + F5.

Why is the same text content rendered differently in <input> than in <div> or <span> tags?

The Situation
I have two pages with identical content and styling. The difference between them is that one lists items with <div> elements and the other with <input> elements (for showing and editing a resource, respectively).
I'd like both pages to have the same layout. I've achieved the layout I want on the standard <div> page and would like to duplicate it on the page with <input> elements. Both pages have the same CSS rules applied to them as well as Eric Mayer's Reset.
The Problem
Text is rendered differently in a <div> element than it is in an <input> element and results in an <input> that is too high.
What's Been Tried
I've tried setting the height of the input so that it is the same as the div, though that causes the text to become clipped at the bottom. I couldn't find a way to remove the white space at the top of the input.
I also did a diff of the computed styles for each element and they are almost identical (aside from a few styles that have no affect on the issue here).
The Question
Is there a way to make the input in the first picture match the height of the div in the second?
Additionally, is there a place where I can learn more about how/why browsers have this sort of behavior and what controls it? I've already read through W3C's CSS Fonts Module Level 3 with unsatisfactory results.
See current state (input, div):
.recipe .header {
margin-bottom: 50px;
text-align: left;
font-weight: 600;
color: #f0424b;
}
.form-recipe input {
font-family: "futura-pt";
}
.header {
margin-bottom: 40px;
font-size: 3em;
text-align: center;
}
// Reset
input {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-family: inherit;
font-size: 100%;
vertical-align: baseline;
}
// User agent stylesheet
input {
padding: 1px 0px;
-webkit-appearance: textfield;
padding: 1px;
background-color: white;
border: 2px inset;
border-image-source: initial;
border-image-slice: initial;
border-image-width: initial;
border-image-outset: initial;
border-image-repeat: initial;
-webkit-rtl-ordering: logical;
-webkit-user-select: text;
cursor: auto;
}
<div class="delicious">
<form name="recipe.edit" class="form form-recipe recipe">
<div class="form-group">
<div class="form-row">
<input type="text" class="header" value="Banana Bread"/>
</div>
</div>
</form>
</div>
.recipe .header {
margin-bottom: 50px;
text-align: left;
font-weight: 600;
color: #f0424b;
}
.header {
margin-bottom: 40px;
font-size: 3em;
text-align: center;
}
// Reset
div {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-family: inherit;
font-size: 100%;
vertical-align: baseline;
}
// User agent stylesheet
div {
display: block;
}
<div class="delicious">
<div class="recipe">
<div class="header">
Banana Bread
</div>
</div>
</div>
How about this? That works if you want them exactly identical. (The spaces between them are because of the other wrappers)
HTML
<div class="delicious">
<form name="recipe.edit" class="form form-recipe recipe">
<div class="form-group">
<div class="form-row">
<input type="text" class="header" value="Banana Bread"/>
</div>
</div>
</form>
</div>
<!------------------------------------------------------------>
<div class="delicious">
<div class="recipe">
<div class="header">
Banana Bread
</div>
</div>
</div>
CSS
.recipe .header {
margin-bottom: 50px;
text-align: left;
font-weight: 600;
color: #f0424b;
}
.form-recipe input {
font-family: "futura-pt";
}
.header {
margin-bottom: 40px;
font-size: 3em;
text-align: center;
width:100%;
border:none;
padding:0;
outline:0;
}
Though I personally wouldn't recommend this, because I believe the user needs to realize that it's now able to edit the contents, anyway, maybe set outline-color:#f0424b and focus the element on edit? outline does not affect the element's width/height but it does give some clue that you are in focus and able to edit.
Hope it helps!

Div footer won't stay at bottom

Hi I've created an angularJs partial. It's a form. However the black bottom bit(form wrapper footer) where the 'next' button is won't go to the bottom/stay at the bottom of the page. It leaves an awkward gap. I want it to mirror the top.
As you can see in the image attachment.
I've spent hours fiddling around and I can't get it to go to the bottom. Any help would be greatly appreciated thanks.
If I use :
position:absolute;
bottom: 0;
It works but it makes the bottom div go beyond the scope to the right.
.form-wrapperTitle {
width: 100%;
height: 15%;
padding-top: 13px;
padding-bottom: 13px;
font-size: 14px;
text-align: center;
color: #bfbfbf;
font-weight: bold;
background: #121212;
border: #2d2d2d solid 1px;
margin-bottom: 30px;
border-top-right-radius: 6px;
border-top-left-radius: 6px;
font-family: Arial;
}
.form-wrapper {
width: 80%;
height: 60%;
margin: 50px auto;
overflow: hidden;
background: #1e1e1e;
border-radius: 6px;
box-shadow: 0px 0px 50px rgba(0, 0, 0, .8);
color: #bfbfbf;
}
.form-wrapperFooter {
width: 100%;
height: 15%;
font-size: 14px;
text-align: center;
color: #bfbfbf;
font-weight: bold;
background: #121212;
border: #2d2d2d solid 1px;
/* margin-bottom: 30px;*/
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
font-family: Arial;
padding-top: 13px;
padding-bottom: 13px;
}
<section class="form-wrapper">
<div class="form-wrapperTitle">Name Your Goal</div>
<br>Here's where it all starts. Saving into your investments with Clear Finance is all about goals.
<br>Everyone saves for something - even if you're not quite sure what it is yet.
<br>
<br>
<form class="form-horizontal" role="form">
<div class=" form-group">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">Form Goal</label>
<div class="col-sm-8">
<input type="text" class="form-control" ng-model="formGoal" placeholder="What is your goal?">
<br>
<strong>Your Goal is:</strong>
<h5>{{formGoal}}</h5>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="form-wrapperFooter">
<button class="btn btn-primary" ng-click="goToNextState('form.goalamount')">Next</button>
</section>
</div>
This can help you:
.form-wrapperFooter{
position:absolute;
bottom:0px;
}
This will work for you if you have very less content on you page that does not take up the height of the whole page.
You were almost there, But you missed a vital piece of the puuzzle:
An absolute position element is positioned relative to the first
parent element that has a position other than static. If no such
element is found, the containing block is <html>
Make your parent relative, and your child Absolute (in terms of positioning).
so your form-wrapper class should include:
position: relative;
padding-bottom:30px;
and your form-wrapperFooter should include:
position:absolute;
bottom:0;
I have also corrected your markup in order for it to be correctly rendered in terms of browser compatibility.
You may want to play with the values, but I think this is the general jist of it:
See below for a working demo:
.form-wrapperTitle {
width: 100%;
height: 15%;
padding-top: 13px;
padding-bottom: 13px;
font-size: 14px;
text-align: center;
color: #bfbfbf;
font-weight: bold;
background: #121212;
border: #2d2d2d solid 1px;
margin-bottom: 30px;
border-top-right-radius: 6px;
border-top-left-radius: 6px;
font-family: Arial;
}
.form-wrapper {
width: 80%;
height: 65%;
margin: 50px auto;
overflow: hidden;
background: #1e1e1e;
border-radius: 6px;
box-shadow: 0px 0px 50px rgba(0, 0, 0, .8);
color: #bfbfbf;
padding-bottom:30px;
position:relative;
}
.form-wrapperFooter {
width: 100%;
height: 5%;
font-size: 14px;
text-align: center;
color: #bfbfbf;
font-weight: bold;
background: #121212;
border: #2d2d2d solid 1px;
/* margin-bottom: 30px;*/
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
font-family: Arial;
padding-top: 13px;
padding-bottom: 13px;
position:absolute;
bottom:0;
}
<section class="form-wrapper">
<div class="form-wrapperTitle">Name Your Goal</div>
<br>Here's where it all starts. Saving into your investments with Clear Finance is all about goals.
<br>Everyone saves for something - even if you're not quite sure what it is yet.
<br>
<br>
<form class="form-horizontal" role="form">
<div class=" form-group">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">Form Goal</label>
<div class="col-sm-8">
<input type="text" class="form-control" ng-model="formGoal" placeholder="What is your goal?">
<br>
<strong>Your Goal is:</strong>
<h5>{{formGoal}}</h5>
</div>
</div>
</div>
</div>
</form>
<div class="form-wrapperFooter">
<button class="btn btn-primary" ng-click="goToNextState('form.goalamount')">Next</button>
</div>
</section>
Try below code:
Align bottom of the page - Add position: relative; to wrapper of the .form-wrapperFooter.
.form-wrapperFooter{
position:absolute;
bottom:0px;
}
Align bottom of the browser
.form-wrapperFooter{
position: fixed;
bottom: 0;
}
The
position: absolute;
bottom: 0;
worked...but the Div went beyond to the right.
so I changed the percentage from 100% to 80%
This is odd considering I wanted the div to fill 100% of the inside div. Changing it to 80% seems to have corrected it. No idea how it worked. Thanks for the input.

How to position the submit button?

I'm looking to make an offline search page powered by Google. I am having a little trouble with the search button though, it just seems to do whatever it wants. I want it to be relative above the textarea on the left. I would like for it to stay in that corner of the textarea even when the textarea is expanded. (This webpage is not designed for multi-browser supported it is, designed for Firefox only.)
<style>
body{
background: url(bg.jpg);
background-size: cover;}
textarea{
display: block;
margin-left: auto;
margin-right: auto;
background-color: black;
border-radius: 12px;
color: #ffffff;
font-family:"Courier New", Courier, monospace;
font-size: 16px;
text-decoration: none;
cursor: poiner;
border: none;}
button{
background-color: #000000;
border-radius: 12px;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
text-decoration: none;
cursor: poiner;
border: none;}
button:hover{
border: none;
background: #5B93F5;}
footer{
position: absolute;
bottom: 0px;
right: 0px;
text-align: right;
color: #FFFFFF;}
</style>
</head>
<body>
<div id="searchContainer">
<form id="searchForm" name="searchForm" onsubmit="onSearchSubmit(event)">
<button id="searchSubmit" type="submit" value="Search" title="Google Search">
<font color="blue">G</font><font color="red">o</font><font color="yellow">o</font><font color="blue">g</font><font color="green">l</font><font color="red">e</font>
</button>
<textarea id="searchText" type="text" name="q" maxlength="255" rows="3" cols="50" autocomplete="off" autofocus></textarea>
</form>
</div>
<footer>v5.0</footer>
</body>
</html>
Add following in your css code:
#searchContainer { text-align: center; }
#searchContainer > form { display: inline-block; text-align: left; }
it should resolve your issue.
For the code you have, you can add a padding to the container: JS Fiddle
Add this line to your CSS:
#searchContainer{padding: 2em; display: inline-block;}
For a little more style if you want them connected, you can adjust some border-radius' and margins of the button and text area: JS Fiddle 2