I want to add a separator image as a border.
Here's the html
<div class="content-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h1>TRACK MY ORDER</h1>
<p>Fill your order number below to track your order</p>
</div>
<div class="col-xs-12">
<form action="">
<div class="order-input">
<input type="text" class="text" placeholder = "Order Number">
<input type="submit" class="submit">
</div>
</form>
</div>
<div class = "col-xs-12 order-info">
<p>Dear Customer, <br><br>
Your Order number 19175 has<br>
been successfully shipped and here are the tracking details:
</p>
</div>
</div>
</div>
</div>
Here's the Css I am trying to have that border.
.order-info p :after {
content: '';
position: absolute;
width: 100%;
height: 50px;
display: inline-block;
background-position: center;
background-repeat: no-repeat;
background-image: url(../assets/gt.png);
top: 0;
}
This I think should work but strangely not working.
Here's this fiddle.
Couple of things to get this to work:
.order-info p:after, no space between p and the :after pseudoelement.
You don't need the :after element to be position: absolute. Just put it static and the way :after works will do the rest:
.order-info p:after {
content: '';
width: 100%;
height: 50px;
display: inline-block;
background-position: center;
background-repeat: no-repeat;
background-image: url(http://i.imgur.com/pcpKrPe.png)!important;
}
Updated fiddle: https://jsfiddle.net/z7p5fzzz/3/
Related
I'd like to add an icon right before the placeholder in a textarea but don't know how to do it.
Here is my code:
<div class="center-part">
<div class="user-input">
<textarea class="share" name="share" type="text"
placeholder="">
</textarea>
</div>
</div>
Thank you.
It is not possible to combine an icon and text in a placeholder. Because you are only able to use 1 font in it. If you could use different fonts inside the placeholder then this would be possible by using fontAwesome.
You can add a span (positioned inside the textarea) and shift the placeholder to the right of the icon by doing this:
HTML (added span in your code):
<div class="center-part">
<div class="user-input">
<textarea class="share" name="share" type="text" placeholder=" Icon before this"></textarea>
<span class="icon"></span>
</div>
</div>
CSS:
.center-part {
position: relative;
min-height: 50px;
min-width: 200px;
}
.share {
min-height: 50px;
min-width: 200px;
}
.icon {
position: absolute;
background: red;
width: 15px;
height: 15px;
left: 10px;
top: 5px;
}
You can see a demo at Codepen
I have been having problems when trying to center a div vertically. From what I have read I have tried with flexbox but failed and then I tried with position: absolute but also failed, e.g.
HTML:
<div="parent">
<div="child">
<h1>Hello World</h1>
<h3>This is a subtitle</h3>
</div>
</div>
CSS:
.parent{
position: relative;
}
.child{
position: absolute;
top: 50%;
transform: translateY(50%);
}
From what I have been reading this should work, so here is my actual code hoping that you guys can find the solution to my problem.
HTML:
<section class="mainSection">
<div class="container">
<div class="row">
<div class="col-md-8">
<!-- THIS IS THE SECTION THAT I CAN'T GET TO WORK -->
<div class="mainSection-mainTitleWrapper">
<div class="mainSection-mainTitle">
<h1>Creating value</h1>
<h3>Through quality assets</h3>
</div>
</div>
<!-- THIS IS THE END OF THE SECTION THAT I CAN'T GET TO WORK -->
</div>
<div class="col-md-4">
<div class="contactForm">
<h4>Buy, Sale & Rent</h4>
<p>Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem ipsum has been the industry's standard dummy text.</p>
<form>
<input type="text" name="user_name" placeholder="FULL NAME">
<input type="emial" name="user_email" placeholder="EMAIL">
<input type="tel" name="user_phone" placeholder="PHONE">
<select>
<option value="buy">BUY</option>
<option value="sale">SALE</option>
<option value="rent">RENT</option>
</select>
<select>
<option value="price" disabled selected>PRICE</option>
<option><$100,000.00</option>
<option><$200,000.00</option>
<option><$400,000.00</option>
<option><$600,000.00</option>
<option><$1,000,000.00</option>
</select>
<input type="submit" name="find" value="FIND NOW">
</form>
</div>
</div>
</div>
</div>
</section>
CSS:
.mainSection{
background: url('img/background.jpg') no-repeat center center;
background-size: cover;
box-shadow: inset 0 0 0 1000px rgba(0,0,0,0.4);
padding-bottom: 50px;
}
.mainSection-mainTitleWrapper{
position: relative;
}
.mainSection-mainTitle{
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.mainSection-mainTitle h1{
font-size: 65px;
color: #fff;
font-weight: bold;
text-transform: uppercase;
}
.mainSection-mainTitle h3{
font-size: 35px;
color: #fff;
font-weight: bold;
text-transform: uppercase;
}
Sorry for the lengthy question, but does anyone have an idea of why is it not working or another possible solution to vertically center the .mainSection-mainTitle div?
Vertical align middle works, but you will have to use table-cell on your parent element and inline-block on the child.
This solution is not going to work in IE6 & 7.
The classic solution (table layout)
Look at this fiddle:
http://jsfiddle.net/mcSfe/
Tested in:
FF3.5
FF4
Safari 5
Chrome 11 & 12
IE9
HTML
Your parent div must have a set hight. Otherwise the child will not know what 50% of nothing is.
<div class="cn">
<div class="inner">your content</div>
</div>
CSS
.cn {
display: table-cell;
width: 500px;
height: 500px;
vertical-align: middle;
text-align: center;
}
.inner {
display: inline-block;
width: 200px; height: 200px;
}
Modern solution (transform)
Since transforms are fairly well supported now (http://caniuse.com/#search=2d%20transforms) there is an easier way to do it.
CSS
.cn {
position: relative;
width: 500px;
height: 500px;
}
.inner {
position: absolute;
top: 50%; left: 50%;
transform: translate(-50%,-50%);
width: 200px;
height: 200px;
}
Look here:
http://jsfiddle.net/0tc6ycvo/1/
I have a series of Bootstrap rows, and I wonder if there's any way to 'link' the content in the columns with a short line, to indicate that they are related? This is how it currently looks:
And this is how I'd like it to look:
This is a sample of the existing code. I'm sure (I hope) I can do this by making using of info-div:before { some CSS } but I'm not entirely sure what.
<div class="row">
<div class="col-sm-6">
<label>LAN IP</label>
<input type="text" class="form-control" v-model="location.lan_ip" />
</div>
<div class="col-sm-6 info-div">
<p class="field-info">If the first two octets of the device's LAN IP (as reported by Meraki) matches this value, the device will resolve to this location during Meraki import.</p>
</div>
</div>
Yes, use :before. It must have content: set or it will not work (css is pseudo-bootstrap).
Since bootstrap padding between columns is always the same, you can just place some element with fixed width and desired position:
* {
box-sizing: border-box;
}
.row {
margin-left: -15px;
margin-right: -15px;
}
p {
margin: 0;
}
.col-sm-6 {
float: left;
width: 50%;
padding-left: 15px;
padding-right: 15px;
}
.row .wrapper {
position: relative;
background: #eee;
min-height: 100px;
}
.row .info-div:before {
content: '';
width: 30px;
position: absolute;
left: -30px;
top: 50%;
height: 1px;
background: black;
}
<div class="row">
<div class="col-sm-6">
<div class="wrapper">
<label>LAN IP</label>
<input type="text" class="form-control" v-model="location.lan_ip" />
</div>
</div>
<div class="col-sm-6">
<div class="wrapper info-div">
<p class="field-info">If the first two octets of the device's LAN IP (as reported by Meraki) matches this value, the device will resolve to this location during Meraki import.</p>
</div>
</div>
</div>
I Can't find error. It's like padding, but padding is 0. Please help me if you can. I kill about hour. You can check it http://codepen.io/sergeviper/pen/ONZWEN
It should be two divs in one big div with fixed height and width should be 100%.
"PICTURE"
.card {
padding: 0px;
background-color: rgba(256, 256, 256, 1);
width: 100%;
display: inline-block;
}
.map {
width: 725px;
height: 368px;
display: inline-block;
}
.auth {
display: inline-block;
width: 275px;
height: 368px;
float: right;
font-family: 'Ubuntu';
font-size: 8pt;
}
<div class="card">
<div class="map">
<img class="map" src="img/map.png" height="374px">
</div>
<div class="auth">
<form>
<h1>Вход на сайт</h1>
<input type="text" placeholder="Логин" />
<input type="password" placeholder="Пароль" />
<br>
<input type="submit" value="ВОйти" />
</form>
<h2 style="color:#999999">Войти с помощью:</h2>
<div class="social">
<div id="vk"></div>
<div id="ok"></div>
<div id="fb"></div>
<div id="gp"></div>
<div id="tw"></div>
</div>
<div class="reg">Регистрация
</div>
<div class="subreg">Забыли пароль
</div>
</div>
</div>
The problem is that the image is 'inline(-block)'. This causes the line-height to create space below the image. Change the image to 'display: block' and this problem is solved.
Try to add margin-bottom: 0;
If it doesn't work, read this - How to get rid of the whitespace at the bottom?, possible solution/duplicate.
Help newbie in div for php or html without using css or table.
Trying to do this 4 x column, 2 x row using div with the following behavior
// [.....adjustable....][fixed][fixed][fixed]
// [.....adjustable....][fixed][fixed][fixed]
Below are my codes----------------------------------------
<form action="welcome.php" method="get">
<div style="position: relative; width: 100%; ">
<div id="left" style="position:relative;float:left;width:68%;"> left </div>
<div id="right" style="float:left;width:13%;"> Name: </div>
<div id="right2" style="float:left;width:13%;"> Age: </div>
<div id="right3" style="float:left;width:6%;"></div>
</div>
<div style="position: relative; width: 100%; ">
<div id="left2" style="position:relative;float:left;width:68%;"> left2 </div>
<div id="right4" style="float:left;width:13%;"> <input type="text" name="name"></div>
<div id="right5" style="float:left;width:13%;"> <input type="text" name="age"></div>
<div id="right6" style="float:left;width:6%;"> <input name="submit" type="submit"></div>
</div>
The 68% is equal to 860 pxl on my screen. It should change if it goes to other screen resolution. I tried making the 68% to 100% and the other div with id=right to style="position:fixed..." but it just mess up and puts everything on left side.
The easiest way of accomplishing this, is by using display: table and display: table-cell, to style divs as a table, without using an actual table:
Example on jsbin. See display on mdn.
I'll add both the CSS version and the, discouraged, inline style version to this post:
CSS version
<div class="parent">
<div class="left">ASDF</div>
<div class="right">asdf</div>
<div class="right">asdf</div>
<div class="right">asdf</div>
</div>
With CSS:
.parent {
display: table;
width: 100%;
}
.left {
width: auto;
border: 1px dotted blue;
display: table-cell;
}
.right {
display: table-cell;
width: 50px;
border: 1px dotted green;
}
Inline style version
<div style="display: table; width: 100%;">
<div style="display: table-cell;">ASDF</div>
<div style="display: table-cell; width: 150px;">asdf</div>
<div style="display: table-cell; width: 150px;">asdf</div>
<div style="display: table-cell; width: 150px;">asdf</div>
</div>