How to create a Facebook-like tool tip layout using Twitter Bootstrap? - html

I'm trying to use twitter bootstrap to create Facebook like tooltip layout.
I would really appreciate if someone could let me know how can I use twitter bootstrap to create this layout, I don't need it as tooltip, I need it in regular div.
I've attached picture the represent what I'm looking for.

Here's my take on that box using the twitter bootstrap framework. Had to modify some span widths in order to conform to your image sizes but i used an id to target them so they won't bother other span* classes throughout your page design.
I put it up on a jsFiddle since its quite a bit of code so check it out: demo here, edit here.
CSS:
body {
margin:50px;
}
#box {
border: 1px solid #92959C;
width:290px;
padding-top: 10px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
-webkit-box-shadow: 0px 0px 4px 0px #ccc;
-moz-box-shadow: 0px 0px 4px 0px #ccc;
box-shadow: 0px 0px 4px 0px #ccc;
}
#box .row {
margin-left: -10px;
}
#box [class*="span"] {
margin-left: 10px;
}
#box .span0 {
width:32px;
margin-left:1px;
}
#box li.span0:first-child {
margin-left: 0;
}
#box .span1 {
width: 96px;
}
#box .span2 {
width:165px;
margin-left:10px;
}
#box .span2 p, .span2 a {
font-size:12px;
margin:0;
}
#box .span2 h4 {
font-size:13px;
line-height:10px;
}
#box .span1 img {
width:96px;
height:96px;
}
#box .img-list {
margin:0;
padding:0;
list-style:none;
}
#box-footer {
margin-top:10px;
width:290px;
border-top:1px solid #aaa;
}
.gray {
background-color:#F2F2F2;
padding:10px 10px 20px;
min-height:20px;
}
​
HTML:
<div class="container">
<div class="row">
<div id="box" class="span4">
<div class="span1">
<img alt="" src="http://placehold.it/96x96">
</div>
<div class="span2">
<h4>Omer</h4>
<p class="muted">AI Lead at New brand analytics</p>
64 mutual friends
<ul class="img-list">
<li class="span0">
<img alt="" src="http://placehold.it/32x32">
</li>
<li class="span0">
<img alt="" src="http://placehold.it/32x32">
</li>
<li class="span0">
<img alt="" src="http://placehold.it/32x32">
</li>
<li class="span0">
<img alt="" src="http://placehold.it/32x32">
</li>
<li class="span0">
<img alt="" src="http://placehold.it/32x32">
</li>
</ul>
</div>
<div class="row">
<div id="box-footer" class="span4">
<div class="gray">
Friends
</div>
</div>
</div>
</div>
</div>
</div>​

Related

need logo in center of page section excluding left sidebar in squarespace

website :https://wells-demo.squarespace.com/
Need logo in center of page section excluding left sidebar(header) in squarespace WELLS template on all format mobile,desktop etc.I am trying to figure out but no result.following is my code
$(document).ready(function(){
$('#headerWrapper #header ').after('<div id="logo1" data-content-field="site-title"><h1 class="logo image" data-shrink-original-size="23" style="letter-spacing: 0.0869565em;"><img src="//static1.squarespace.com/static/5adfd10929711421a9b29d21/t/5adfdbac562fa79909bad158/1524908392416/?format=750w" alt="L ETO BRIDAL" width="130" height=50"></h1></div>');
});
#logo{display:none;}
#headerWrapper{top:4px!important}
#logo1 h1 a img {
height:70px!important;
}
#logo1 {
left: 300%;
position: absolute;
text-align: center !important;
top: 10px !important;
transform: translateX(-50%);
Based on your current CSS, this should do it:
#logo {
width: 100%;
text-align: center;
}
#media (min-width: 801px) {
#logo {
position: fixed;
width: calc(100% - 340px);
top: 0;
margin-left: 240px;
box-sizing: border-box;
background-color: #ffffff85;
padding: .5rem 0;
border-bottom: 1px solid #fff;
}
}
Note: in current form, your question is not really useful to future visitors.
You can read the structure i made below using w3.css from w3schools. I have given a border colour to every div so you can see the boundary of that div and it will make it easy to learn for you.
.outer
{
border:1px solid red;
min-height:100px;
width:100%;
}
.inner-left
{
border:1px solid green;
}
.inner-right
{
border:1px solid blue;
}
.centetr
{
text-align:center;
}
.photo
{
width:95%;
margin:0px auto;
height:40px;
}
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<div class="w3-container outer">
<!--left side-->
<div class="w3-quarter inner-left">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
</ul>
</div>
<div class="w3-rest inner-right">
<div class="w3-container w3-margin-bottom centetr">
NAME
</div>
<div class="w3-container">
<div class="w3-half">
<img src="" class="photo">
</div>
<div class="w3-half">
<img src="" class="photo">
</div>
<div class="w3-half">
<img src="" class="photo">
</div>
<div class="w3-half">
<img src="" class="photo">
</div>
</div>
</div>
</div>

Affect only one div among 3 divs having the same properties after hover effect

I have been working on this project for a while and it works fine but when I implement it, it stops working:
.carousel-promo {
font:normal 14px sans-serif;
position:relative;
}
.carousel-promo.item{
position: absolute;
top: 0;
left: 0;
}
.carousel-promo button{
border-radius: 2px;
background-color: #87bae1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
border: 0;
color: #ffffff;
font-weight: bold;
font-size: 13px;
cursor: pointer;
margin: 10px 0 0 10px;
width: 95px;
height: 32px;
z-index:20;
}
.carousel-promo .product-out-of-stock{
color: #c15017;;
font-weight: bold;
line-height: 55px;
margin: 10px 0 0 10px;
width: 95px;
height: 32px;
z-index:20;
position:relative;
}
.carousel-promo .product-price{
float: right;
margin: 10px 10px 0 0;
font-weight: bold;
font-size: 15px;
padding-top: 6px;
z-index:20;
}
.carousel-promo .product-price .price-old{
text-decoration: line-through;
color: #888888;
}
.carousel-promo .product-price .price-old{
color: #ee001c;
}
.carousel-promo .sale_badge{
position:absolute;
z-index:2;
width:60px;
height:60px;
transition: all 150ms ease-in-out 0s;
border-radius: 0 0 30px 0;
line-height:60px;
box-shadow: 0px 2px 1px rgba(0, 0, 0, 0.1);
font-size:14px;
color:#ffffff;
background-color:#83d4fb;
text-align:center;
}
.carousel-promo > div:hover .sale_badge {
width:70px;
height:70px;
line-height:70px;
}
<div class="carousel-promo">
<div class="item">
<div class="sale_badge">-20%</div>
<div class="image"><img src="https://placehold.it/300x150" alt="" /></div>
</div>
<div class="item">
<div class="sale_badge">-20%</div>
<div class="image"><img src="https://placehold.it/300x150" alt="" /></div>
</div>
<div class="item">
<div class="sale_badge">-20%</div>
<div class="image"><img src="https://placehold.it/300x150" alt="" /></div>
</div>
</div>
After running the snippet, when you will over a div, the size of the price tag of that specific div will increase.
Once I implement it, when I hover one div, all the price tag increase.
I am using owlcarousel to slide the item and my original html code is the following (the CSS is the same as what I have been working with since):
<div class="container-promo">
<h3>Article en promotion</h3>
<div class="carousel-promo">
<div class="item">
<div class="sale_badge">-20%</div>
<div class="image"><img src="images/13.jpg" alt="" /></div>
</div>
<div class="item">
<div class="sale_badge">-20%</div>
<div class="image"><img src="images/14.jpg" alt="" /></div>
</div>
<div class="item">
<div class="sale_badge">-20%</div>
<div class="image"><img src="images/15.jpg" alt="" /></div>
</div>
</div>
</div>
Kindly help me solve this problem.
Sorry I am not a native english speaker, I am trying my best.
That's because you are targeting div tag on hover, while owl-carousel adds some wrapper divs as well. So, logically when ever we hover over a div code works and all price tags shows up. You may have to target your price tags in this specific way so that only .item class hover takes that css effect. So, change you last css code line
.carousel-promo > div:hover .sale_badge {
width:70px;
height:70px;
line-height:70px;
}
with following code which is just a bit changed than yours
.carousel-promo > div.item:hover .sale_badge {
width:70px;
height:70px;
line-height:70px;
}
And so, exact price tags will be shown on hover.

Create a box with border on twitter bootstrap using css3

I am trying to create a responsive box in twitter bootstrap exactly like this:
Now, I have created a coloumn:
<div class="col-lg-4" style="border-style: solid;">
<h2>Title</h2>
<p>Data</p>
</div>
Giving border to all of this doesn't work. What would be the best way fellas?
Something like this maybe? Demo
HTML
<div class="row">
<div class="col-lg-4">
<h2 class="title">Python Native Datatypes</h2>
<div class="box">
<ul>
<li>Data</li>
<li>Data</li>
<li>Data</li>
</ul>
</div>
</div>
CSS
.box {
border: solid 1px #000;
padding: 10px;
z-index:0;
position: relative;
width:90%;
margin: -20px auto 0 auto;
}
.box li {
list-style: none;
}
.title {
background:green;
z-index:1;
position: relative;
padding: 5px;
text-align:center;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
color: #fff;
font-weight: 200;
}

how to align text in div

Im trying to display 4 pictures with a title, description and a delete link on it. I cannot get the link to float right in the box I have.
here's the html
<div id="container">
<div class="image-wrapper">
<div id="image-container">
<img src="gallery_traditional_1.jpg" width="200" height="100"><br>
<span class="img-info">Title:</span>
<span class="img-info">Description:</span>
<span class="img-info alignright">Delete</span>
</div>
</div>
</div><!--end container -->
here's the css
#container {
width: 50%;
}
.image-wrapper {
display: inline-block;
width:200px;
padding: 10px;
}
#image-container {
color: #898989;
background:#F9F9F9;
border: solid 1px #ddd;
border-radius:10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
box-shadow: 0px 0px 10px #888;
-moz-box-shadow: 0px 0px 10px #888;
-webkit-box-shadow: 0px 0px 10px #888;
margin:5px auto;
padding:5px;
width:200px;
}
.img-info {
display: block;
}
.alignleft {
float:left;
}
.alignright {
float:right;
}
The html of the picture box gets repeated 3 more times. How can I get the third span link float to the left? Any help would be great.
Adding margin-top: -29px; should achieve this.
DEMO http://jsfiddle.net/4RZJx/1
HTML:
<div id="container">
<div class="image-wrapper">
<div id="image-container">
<img src="gallery_traditional_1.jpg" width="200" height="100"><br>
<span class="img-info">Title:</span>
<span class="img-info">Description:</span>
<span class="img-info">Delete</span>
</div>
<span class="img-info alignright">Delete</span>
</div>
<div class="image-wrapper">
<div id="image-container">
<img src="gallery_traditional_1.jpg" width="200" height="100"><br>
<span class="img-info">Title:</span>
<span class="img-info">Description:</span>
<span class="img-info">Description:</span>
</div>
<span class="img-info alignright">Delete</span>
</div>
<div class="image-wrapper">
<div id="image-container">
<img src="gallery_traditional_1.jpg" width="200" height="100"><br>
<span class="img-info">Title:</span>
<span class="img-info">Description:</span>
</div>
<span class="img-info alignright">Delete</span>
</div>
<div class="image-wrapper">
<div id="image-container">
<img src="gallery_traditional_1.jpg" width="200" height="100"><br>
<span class="img-info">Title:</span>
<span class="img-info">Description:</span>
</div>
<span class="img-info alignright">Delete</span>
</div>
</div><!--end container -->
CSS:
#container {
width: 50%;
}
.image-wrapper {
display: inline-block;
width:200px;
padding: 10px;
}
#image-container {
color: #898989;
background:#F9F9F9;
border: solid 1px #ddd;
border-radius:10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
box-shadow: 0px 0px 10px #888;
-moz-box-shadow: 0px 0px 10px #888;
-webkit-box-shadow: 0px 0px 10px #888;
margin:5px auto;
padding:5px;
width:200px;
}
.img-info {
display: block;
}
.alignleft {
clear: both;
float:left;
}
.alignright {
float:right;
margin-top: -29px;
}
First of all, where are you using .alignleft in your code provided?
Secondly, the .alignright span has two classes: img-info and alignright. For img-info you have display-block. This is redundant, as the float property will make an element display-block.
All you need to do is add overflow: hidden to your main div (image-container). The float applied to the link makes it act as though it's not in the same "layer". Adding overflow-hidden will fix this problem. Jsfiddle - http://jsfiddle.net/piedoom/6jTyD/
Try this really quick fix, however, you may want to modify the widths and such:
DEMO: http://jsfiddle.net/4RZJx/
<div id="container">
<div class="image-wrapper">
<div id="image-container">
<img src="gallery_traditional_1.jpg" width="200" height="100"><br>
<div class="info-container">
<div class="alignleft">
<span class="img-info">Title:</span>
<span class="img-info">Description:</span>
</div>
<span class="img-info alignright">Delete
</span>
</div>
</div>
</div>
</div><!--end container -->
CSS:
#container {
width: 50%;
}
.image-wrapper {
display: inline-block;
width:200px;
padding: 10px;
}
#image-container {
color: #898989;
background:#F9F9F9;
border: solid 1px #ddd;
border-radius:10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
box-shadow: 0px 0px 10px #888;
-moz-box-shadow: 0px 0px 10px #888;
-webkit-box-shadow: 0px 0px 10px #888;
margin:5px auto;
padding:5px;
width:200px;
}
.info-container{
overflow: hidden;
}
.img-info {
display: block;
}
.alignleft {
float:left;
}
.alignright {
float:right;
}
Use text-align:
.alignleft {
text-align: left;
}
.alignright {
text-align: right;
}
float is better used for when you want a image to go to the right, and want text to flow around it etc. As it also cause other layout problems, you might as well try text-align.
http://jsfiddle.net/4RZJx/3/

Creating "product" tables with div's

I'm currently working on some web coursework and as you'll notice I lack experience in web development. Basically I'm trying to create tables that hold products for a shop, however I want to use div tree's for the most part and if necessary forms for the text.
Essentially I want each independent table to hold an image, a description and eventually other data implemented with JS (I don't need help with this.. yet ^^). Hopefully you'll see what I'm trying to do from the code;
<div id="items">
<div id="item1" class="items">
<img src="img/products/robot1.jpg"/>
</div>
<div id="item2" class="items">
<img src="img/products/robot2.jpg"/>
</div>
<div id="item3" class="items">
<img src="img/products/robot3.jpg"/>
</div>
</div>
#content {
width: 600px;
padding-top: 10px;
padding-bottom: 30px;
margin-left: auto;
margin-right: auto;
}
.items{
display:inline;
}
#items {
padding-top:10px;
}
#items img{
border: 1px solid rgba(207, 207, 207, .7);
border-radius:20px;
}
The div's are parented by the 'content' container which is 600px wide, each table would have to be roughly 193px wide to fit three "products" on a row taking margins into consideration.
I drew a quick picture to represent exactly what I'm aiming for (the 'button' represents the 'add to basket' feature).
Unfortunately I can't use any frameworks such as jquery for the task so I'm stuck doing things the hard way. Apologies in advance for my lack of experience but hopefully you can put me in the right direction.
Edit: Using div's is just a preference, if it would be easier to use standalone forms I wouldn't mind.
Maybe this will point you in the right direction.
HTML:
<div id="content" class="clearfix">
<div id="items">
<div id="item1" class="items">
<img src="img/products/robot1.jpg"/>
Add
</div>
<div id="item2" class="items">
<img src="img/products/robot2.jpg"/>
Add
</div>
<div id="item3" class="items">
<img src="img/products/robot3.jpg"/>
Add
</div>
</div>
</div>
CSS:
.clearfix { *zoom: 1; }
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
#content {
width: 600px;
padding-top: 10px;
padding-bottom: 30px;
margin-left: auto;
margin-right: auto;
background:red;
}
.items{
float:left;
width:193px;
min-height:100px;
border:1px solid black;
position:relative;
}
.items a.add-basket {
position:absolute;
bottom:0;
right:0;
background:black;
color:#fff;
}
#item1 { margin-right:7px; }
#item2 { margin-right:7px; }
#items {
padding-top:10px;
}
#items img {
border: 1px solid rgba(207, 207, 207, .7);
border-radius:20px;
}
http://jsfiddle.net/DNS8P/1/
Here's a FIDDLE by the image you provide.
<div id="content">
<h1>Products</h1>
<div id="items">
<div id="item1" class="items">
<img src="img/products/robot1.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
<div id="item2" class="items">
<img src="img/products/robot2.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
<div id="item3" class="items">
<img src="img/products/robot3.jpg"/>
<span class="desc">Description</span>
<span class="price">$100</span>
<span class="other">Other</span>
<button>BUY</button>
</div>
</div>
</div>
#content {
width: 600px;
padding: 10px 10px 30px 10px;
margin: 30px auto;
text-align: center;
border: 1px solid #999;
}
#items {
padding-top:10px;
}
.items{
display: inline-block;
text-align: center;
width: 180px;
margin: 0 7px 0 7px;
padding-top: 10px;
border: 1px solid #999;
border-radius: 20px;
}
.items img {
width: 160px;
height: 140px;
border: 1px solid rgba(207, 207, 207, .7);
}
.items button {
background: #666;
width: 80px;
height: 26px;
float: right;
border-top: 1px solid #999;
border-left: 1px solid #999;
border-right: none;
border-bottom: none;
outline: none;
cursor: pointer;
border-bottom-right-radius: 20px;
transition: background 0.2s ease-in;
}
.items button:hover {
background: #888;
}
.desc,
.price,
.other {
display: block;
margin-bottom: 10px;
}