Number/Div Overlapping - html

I've got a div at the top right of my website which updates showing how many items in your basket. If there is 1 digit, it shows fine, however if it's double digits (10,11,12 etc..) it overlaps. Any idea how to get it to just become wider to show without overlapping?
I've provided a link to a product page so people can add X amount of products and test.
http://bit.ly/17oT6Jo
<!-- Live Basket (Top Right) -->
<div id="tr-basket">
<div class="span4 offset4">
<img src="<?php echo HTTP_HOST; ?>img/basket-icon.png" class="tr-shopping-basket-icon" />
<div id="tr-basket-count"><?php echo number_format($basket->basketCount()); ?></div>
<div id="tr-basket-title">
<p>ITEM<?php if($basket->basketCount()!=1){ ?>S<?php } ?> IN YOUR BASKET<br />
<a href="<?php echo HTTP_HOST; ?>Basket"><span class="label label-info">VIEW</span>
<span class="label label-info">CHECKOUT</span></a>
<!-- <span class="label label-success">ACCOUNT</span> -->
</p>
</div>
</div>
</div>
<!-- End Live Basket -->
css
#tr-basket-count {
display: inline-block;
font-size: 5.5em;
color: #ef798d;
margin-top: 25px;
}
#tr-basket-title p {
display: block;
margin-top: -55px;
margin-left: 100px;
color: #82bdc8;
font-weight: bold;
}
#tr-basket-buttons {
display: block;
margin-left: 100px;
margin-top: 0px;
}

The problem stems from a combination of using a float, followed by an inline-block and finally a block element with a negative top margin all within the <div class="span4 offset4"> containing block.
What I would do is float the img, #tr-basket-count and #tr-basket-title to the left
and apply overflow: auto to the parent div to keep things in one block formatting context.
Be sure to reset the margins on the p element in #tr-basket-title.

Try this:
#tr-basket-title
{
float: right;
}
Add float: right to this element: <div class="span4 offset4" style="float: right; margin-left: 0"></div>

Related

How do I get a DIV box to fill the webpage and not go to the left?

I have a client's website that I am trying to fix... The booking page should have the address on the left and the contact form on the right and the white box should fill the webpage.
At the moment, the DIV box just aligns to the left and this means that the contact form and address are squashed together. What can I do? Here is the webpage
.box {
background-color: white; /* for visualization purposes */
display: inline-block;
max-width: 100%;
}
.box2 {
display: inline-block;
padding: 20px 20px;
max-width: 100%;
}
<div class="content">
<div class="wrap">
<div class="contact">
<h1>Book an Appointment Online or via Telephone/Email:</h1>
<div class="section group contact1">
<div class="col span_1_of_3">
<div class="company_address">
<h3>Company Information:</h3>
<p>BY APPOINTMENT ONLY</p>
<p>Imani Skin Clinic,</p>
<p>8-10 Sneyd Street</p>
<p>Cobridge</p>
<p>ST6 2NZ</p>
<p>United Kingdom</p>
<p>Phone:+447305585588</p>
<p>Email: <span>info#imaniskinclinic.com</span></p>
<br />
<br />
<div id="share-buttons">
<!-- Twitter -->
<a href="https://twitter.com/imaniskinclinic" target="_blank">
<img src="https://simplesharebuttons.com/images/somacro/twitter.png" alt="Twitter" />
</a>
<!-- Facebook -->
<a href="http://www.facebook.com/imaniskinclinic" target="_blank">
<img src="https://simplesharebuttons.com/images/somacro/facebook.png" alt="Facebook" />
</a>
<!-- Instagram -->
<a href="http://www.instagram.com/imaniskinclinic" target="_blank">
<img src="images/insta.jpg" alt="Instagram" />
</a>
</div>
<br />
<br />
</div>
<div id="contact"><a class="shedul-embed-button-link" style="overflow: visible; cursor: pointer; background: rgb(248,171,190); color: rgb(255, 255, 255); border: 0px; display: inline-block; outline: none; padding: 10px 15px; margin: 0px; font-family: Roboto, sans-serif; font-size: 16px; line-height: 16px; text-decoration: none; border-radius: 3px; -webkit-appearance: none; box-shadow: none;" href="https://www.fresha.com/providers/imani-skin-clinic-ltd-cgfhlxsq">Book Now</a><script>!function(e){var t="shedul-embed-button-loader",d="https:"===e.location.protocol?"https":"http",n=e.getElementsByTagName("head")[0];if(!e.getElementById(t)){var o=e.createElement("script"),p=e.createElement("style");o.id=t,o.src="https://app.shedul.com/embed_button.js".replace(/^\w+/,d),p.type="text/css",p.innerHTML=".shedul-widget-open { position: fixed; overflow:hidden; }",n.appendChild(o),n.appendChild(p)}}(document);</script></div>
</div>
<div class="col span_3_of_3">
<div class="contact-form">
<div id="zbwid-fbedad33"></div>
</div>
</div>
You've to do two things first give contact1 class to 100% width, though it's already there but syntax error. Put !important otherwise it will be overruled
.contact1{ width: 100% !important }
Then div that contains col span_3_of_3 classes, give this div a class with floating point
.your-class-name{ float: right !important }
You are good to go
For the class ".section", make width 100% instead of auto.
Above the div class="company_address", there is one div with class "col span_1_of_3",
For ".span_1_of_3", increase width to 50%.
And for ".col span_3_of_3", increase width to 30%, and set float: right.
You may adjust the widths according to your needs and for responsive design.
Start by fixing your HTML to mark all needed elements - container (or wrapper) and contact box + address box inside it. Then you can float the contact box and address box to the left or right. Also your CSS is targeting 2 classes that do not exist in your HTML.

Grid Breakpoints not covering width of screen

Technologies:
Bootstrap 3
Less
Jade
Angular
Issue:
I'm using .col-xs-12.col-md-6 for the section.
For some reason when it should switch from .col-md-6 and .col-xs-12 should be applied so that the column can stretch the full width of the screen, the layout doesn't spread out until 743 screen width. (It should go full width at 991px or if i'm wrong atleast 767px screen width).
I have custom styling on .col-md-6 and apply 49% to the width of that class bc .col-md-5 was too small and .col-md-6 was too large to add the needed 20px margin space in between. (styling guidelines).
I removed the width: 49%; when seeing what would happen at the 992 and 768 break point and there is nothing.
It just breaks at random breakpoints.
(I've tested where it breaks for col-lg-6 and col-xl-6 or 5 .. just to test it out and it continues to break in break point areas not connected to the usual 768, 992, 1200 etc.)
I have removed styling from every place possible to see if thats effecting it ..
This is an include file and so even styling connected to the main page. (I put it back bc that wasn't the cause).
These break point additions have worked in the past I don't know whats wrong now.
My only other alternative is using media queries instead which I will try in the meantime but I am wanting to avoid that.
Update:
I reformatted the code in an entirely separate file from the project and put it in regular html and it worked fine. I copied and pasted the code at the very bottom. I removed angular and left it hard coded so that i can open in the browser quickly. I am thinking it may have something to do with the surrounding files in this project. I copied and pasted the code at the very bottom.
Jade file:
#pizza
.col-xs-12
h3 Other Shops
.col-xs-12.col-md-6(ng-repeat="other in otherShops")
.col-xs-12(ng-repeat="tag in other.tags | limitTo: 1")
img(ng-src="{{tag.sm_active_url}}")
{{tag.name}}
.col-xs-3
img(src="http://www.carlotfinance.com/assets/img/car_placeholder.jpg", alt="placeholder image")
.col-xs-8
h2
a(href="#/shops/{{shop.id}}/detail") {{ other.name }}
.glyphicon.glyphicon-road
.glyphicon.glyphicon-unchecked
p {{ other.address }}
p {{ other.phone }}
button.btn.col-xs-12.makeAppointmentBtn(type='button', ng-controller='makeAppointmentCtrl', ng-click='open()') Make Appointment
Less:
#pizza{
h3{
color: #999;
}
.col-md-6{
background-color: #ffffff;
border-radius: 8px;
margin-bottom: 50px;
padding-left: 0;
padding-right: 0;
// width: 49%;
min-height: 440px;
&:nth-child(even){
margin-right: 20px;
}
h2{
a{
color: #000;
}
a:hover{
text-decoration: none;
}
}
.col-xs-3{
margin-left: 20px;
margin-top: 30px;
img{
width: 100%;
}
}
.btn{
position: absolute;
background-color: #003366;
padding: 10px;
border-radius: 8px;
color: #fff;
bottom: 0;
left: 0;
}
.glyphicon{
color: #999;
font-size: 24px;
}
.col-xs-12{
font-size: 24px;
margin-top: 20px;
img{
margin-left: 20px;
}
}
.col-xs-8{
margin-bottom: 40px;
}
}
}
Reformatted code:
<!DOCTYPE html>
<html class="full" lang="en">
<head>
<title>Pizza</title>
<!-- Bootstrap Core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="col-xs-12 col-md-6 ng-scope">
<div class="col-xs-12">
<img ng-src="https://garageapi.herokuapp.com/tag_tab_icons/Tools/icon-tool-darkblue-25.png" src="https://garageapi.herokuapp.com/tag_tab_icons/Tools/icon-tool-darkblue-25.png"> Tools</div><!-- end ngRepeat: tag in other.tags | limitTo: 1 -->
<div class="col-xs-3"><img src="http://www.carlotfinance.com/assets/img/car_placeholder.jpg" alt="placeholder image"></div>
<div class="col-xs-8">
<h2>Pizza Place
<div class="glyphicon glyphicon-road"></div>
<div class="glyphicon glyphicon-unchecked"></div>
</h2>
<p>1234 M Ave, Austin, TX 27000</p>
<p>(555) 400 2800</p>
</div>
<button type="button" class="btn col-xs-12 makeAppointmentBtn ng-scope">Make Appointment</button>
</div>
<div class="col-xs-12 col-md-6 ng-scope">
<div class="col-xs-12">
<img ng-src="https://garageapi.herokuapp.com/tag_tab_icons/Tools/icon-tool-darkblue-25.png" src="https://garageapi.herokuapp.com/tag_tab_icons/Tools/icon-tool-darkblue-25.png"> Tools</div><!-- end ngRepeat: tag in other.tags | limitTo: 1 -->
<div class="col-xs-3"><img src="http://www.carlotfinance.com/assets/img/car_placeholder.jpg" alt="placeholder image"></div>
<div class="col-xs-8">
<h2>Pizza Place
<div class="glyphicon glyphicon-road"></div>
<div class="glyphicon glyphicon-unchecked"></div>
</h2>
<p>1234 M Ave, Austin, TX 27000</p>
<p>(555) 400 2800</p>
</div>
<button type="button" class="btn col-xs-12 makeAppointmentBtn ng-scope">Make Appointment</button>
</div>
</body>
</html>

How to prevent table-cell from expanding

https://jsfiddle.net/pepgw4cz/1/
This is a typical article list scenario, every item has its image, title, introtext and created time. As you can see in the 2nd item, where the title is longer, the table exceeds its designated width. This could be easily solved by flex, but my client is using a 2011 laptop with IE9 and she wouldn't let go.
So I am stuck with table. The container's width is unknown(fit mobile screen) as well as the itemBody's width(actually, setting them to a fixed width doesn't change anything.), and the item Title has to be limited to one line(white-space:nowrap), which contributes to the problem.
Here is the codes, I copy it from my site so the structure looks a little wierd, but look at the fiddle and you will get the idea
<ul>
<li class="card " k2id="84">
<div class="moduleItemImageContainer">
<a class="moduleItemImage">
</a>
</div>
<div class="moduleItemBody">
<div class="moduleItemBodyContainer">
<span class="moduleItemDateCreated">2016-06-11</span>
<a class="moduleItemTitle">Norm</a>
<div class="moduleItemIntrotext">
人民大会堂国庆宴会的细节 </div>
</div>
</div>
</li>
<li class="card " k2id="83">
<div class="moduleItemImageContainer">
<a class="moduleItemImage">
</a>
</div>
<div class="moduleItemBody">
<div class="moduleItemBodyContainer">
<span class="moduleItemDateCreated">2016-06-11</span>
<a class="moduleItemTitle">Looooooooong Title Long titleLooooooooong Title Long titl</a>
<div class="moduleItemIntrotext">
人民大会堂国庆宴会的细节 </div>
</div>
</div>
</li>
</ul>
<style>
li {
width: 100%;
list-style: none;
display: table;
margin-bottom: 16px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8)
}
li>* {
display: table-cell;
vertical-align: top
}
div.moduleItemImageContainer{width:1%}
a.moduleItemImage {
display: block;
background-image: url('http://placehold.it/100x100');
width: 100px;
height: 100px;
}
a.moduleItemTitle{white-space:nowrap;overflow:hidden;display:block}
div.moduleItemBody {
padding: 16px;
}
div.moduleItemBodyContainer{
height:68px;overflow:hidden
}
span {
float: right
}
ul {
width: 500px
}
</style>
So, how to prevent table from behaving like this?
just give your div.moduleItemBody a max-width:1px; DEMO
and if you want your title to break in multiple lines if it is too long then remove white-space: nowrap; from a.moduleItemTitle DEMO
<table style='table-layout:fixed'>
For those who use bootstrap, please you can add a class class="text-wrap" on the cells.
This will automatically give the required width to the table cells according to the data its holding.

Image next to a paragraph inside a box

I have recently tried to code a box, contains an image on the left side and next to it an header & paragraph under right like this:
http://gyazo.com/c5165fa45c32f69499768ba95d815328
This is what i have done:
<div class="span4">
<div class="box">
<img src="img/share.png" class="image_margin"/>
<span class="box_title">SHARE</span>
<span id="texting">Upload files straight from you hard disc. Up to 600MB per file upload! the more you earn the more file storage you get.</span>
</div>
</div>
CSS:
.box {
background-image: url("../img/box.png");
width: 305px;
height: 117px;
}
#texting {
font-size: 14px;
}
.image_margin{
margin-top: 25px;
margin-left: 25px;
}
.box_title{
font-size: 24px;
color: #8d8d8d;
margin-left: 15px;
margin-top: 20px;
position: absolute;
}
This is the result:
http://gyazo.com/f600c42f86b51e52de436631fc96656d
Why the text gets out of the box yet its inside the class of the box ?
What have I done wrong? how do I align the title + paragraph like in the first image in CSS so it fits on all screens?
Thank you a lot!
Use align="left" in img tag.
<img src="img/share.png" class="image_margin" align="left"/>
Hope this will help

Get image to float to the right of a number of divs

I have the following HTML:
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://www.rtwilson.com/robintheme/style.css" />
</head>
<body>
<div id="branding">
<div id="blog-title">
<h1>Robin's Blog</h1>
</div>
<div id="logo-div" style="float:right; display:inline;">
<img class="logo" src="http://rtwilson.com/academic/mugshot.jpg" height=100px>
</div>
<h1 id="blog-description">A PhD student talking about interesting things</h1>
</div>
</body>
</html>
I am trying to get the image to display to the right of both of the h1's but without creating a gap between the h1's. That is, I would like the top of the image to be aligned with the top of the first h1, the image to be on the right, and the spacing between the h1's to be exactly how it would be without an image there.
I thought it could do this by floating the image to the right and setting the display property to inline, but I've tried this and there is a gap between the h1's.
How can I fix this?
Fiddle: http://jsfiddle.net/9vRLH/
Demo: http://jsfiddle.net/9vRLH/embedded/result/
Try the below css and HTML: Please se inline Css in image div.
#blog-title {
float: left;
font-family: 'Droid Serif',serif;
font-size: 40px;
font-weight: 400;
}
#blog-description {
clear: left;
float: left;
font-family: 'Droid Serif',serif;
font-size: 20px;
}
<div id="blog-title">
<h1><a rel="home" title="Robin's Blog" href="http://127.0.0.1:8888/wordpress/">Robin's Blog</a></h1>
</div>
<div style="float: right; display: inline;" id="logo-div">
<img height="100px" src="http://rtwilson.com/academic/mugshot.jpg" class="logo">
</div>
<h1 id="blog-description">A PhD student talking about interesting things</h1>
I'd float the image right and give the divs some right-margin, like this:
<div id="branding">
<img class="logo" style="float:right;" src="http://rtwilson.com/academic/mugshot.jpg" height="100">
<div id="blog-title" style="margin-right: 110px;">
<h1>Robin's Blog</h1>
</div>
<h1 style="margin-right: 110px;" id="blog-description">A PhD student talking about interesting things</h1>
</div>
Fiddle: http://jsfiddle.net/Qch6u/
I recommend something like the following for these reasons:
The HTML is more concise (less elements), and reflects better the intent of your titling--a main title with a subtitle description. Generally, one should only have a single h1 tag on a page, and this places both the relevant pieces into a single tag. A search engine will now read it as a single title "Robin's Blog A PhD student talking about interesting things" instead of as two items "Robin's Blog" ... "A PhD student talking about interesting things."
Since you want the image to not interfere at all with the text, then using absolute positioning to effect that makes sense, as it will never cause any gaping in the text, nor reposition itself down the page. Of course, it is then good to at least give a min-width to keep from any overlap of the image to the text.
HTML
<div id="branding">
<h1>
<a id="blog-title" href="http://127.0.0.1:8888/wordpress/" title="Robin's Blog" rel="home">Robin's Blog</a>
<span id="blog-description">A PhD student talking about interesting things</span
</h1>
<img src="http://rtwilson.com/academic/mugshot.jpg" >
</div>
CSS
#branding {
padding-right: 110px;
position: relative;
min-height: 100px;
font-family: 'Droid Serif',serif;
min-width: 200px;
}
#branding img {
height: 100px;
position: absolute;
top: 0;
right: 0;
}
#blog-title {
color: black;
font-size: 40px;
font-weight: 400;
text-decoration: none;
}
#blog-description {
display: block;
font-size: 20px;
}