CSS Image Hover surprisingly not working? - html

I'm trying to create a hover effect that will change the color of the image to blue, as the mouse hovers it. I've already created a class for the images and styled it in my css but its still not working. I've also tried changing z-indexes but to no avail.
#import url(http://fonts.googleapis.com/css?family=Black+Ops+One:400,700); /*--- Header --*/
#import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700); /*--- Navigation --*/
*
{
margin: 0;
border: 0;
padding: 0;
}
body
{
background-image: url('../Images/background.png');
background-repeat: repeat-x;
}
.clearfix
{
clear:both;
}
#wrapper
{
margin: 0 auto;
max-width: 1120px;
overflow: auto;
border: 1px solid black;
}
#main_header
{
width: 100%;
font-family: 'Black Ops One', sans-serif;
background-color: black;
border: 1px solid black;
color: white;
}
#main_header h1
{
float: left;
font-size: 380%;
margin: -10% 0 0 2%;
}
#callout
{
margin: 50px 20px 0 0;
}
#callout h2{
text-align: right;
color: white;
}
#callout p{
text-align: right;
padding: 0%;
color: grey;
font-size: 20px;
margin-bottom: 3px;
}
#nav_menu
{
width: 100%;
height: 10%;
background-color: white;
}
#nav_menu li
{
display: inline-block;
margin: 20px 20px 20px 63px;
font-family: 'Open Sans', sans-serif;
font-size: 20px;
font-weight: bold;
}
#nav_menu li a
{
text-decoration: none;
color: black;
}
#nav_menu li a:hover
{
color: grey;
}
#content_area
{
width: 100%;
margin: 10px;
}
.sub-menu
{
position: absolute;
background-color: white;
list-style-type: none;
width: 5px;
display: none;
z-index: 60;
border-radius: 15px;
}
#nav_menu .sub-menu li a
{
color: black;
}
#nav_menu li:hover .sub-menu
{
display: block;
}
#nav_menu li .sub-menu
{
width: 16.5%;
}
#nav_menu li .sub-menu li
{
display: block;
margin-left: 20px;
}
.sub-menu li:hover
{
color: green;
background-color: yellow;
}
/*--- Start Image Slider --*/
.slider{
max-width: 1100px;
box-shadow: 0px 0px 0px 0 rgba(0, 0, 0, 0.07);
}
.slider1 img{
width: 100%;
margin: 0 auto;
}
.slider .bx-wrapper .bx-controls-direction a{
outline: 0 none;
position: absolute;
text-indent: -9999px;
top: 40%;
height: 71px;
width: 40px;
transition: all 0.7s;
}
.slider .bx-wrapper:hover .bx-controls-direction a{
}
.slider .bx-wrapper .bx-prev{
background: url("../Images/arrow_left.png") no-repeat 7px 9px;
left: 0px;
}
.slider .bx-wrapper .bx-prev:hover{
background: url("../Images/arrow_left.png") no-repeat 8px 15px;
}
.slider .bx-wrapper .bx-next{
background: url("../Images/arrow_right.png") no-repeat 10px 12px;
right: 0px;
}
.slider .bx-wrapper .bx-next:hover{
background: url("../Images/arrow_right.png") no-repeat 10px 17px;
}
/*--- End Image Slider --*/
.one-third img{
text-align: center;
max-width: 100%;
height: auto;
opacity: 0.9;
}
.border_section p{
font-family: 'Lato', sans-serif;
padding: 2%;
color: white;
text-align: justify;
}
.border_section h3
{
font-family: 'Open Sans', sans-serif;
text-align: center;
color: white;
text-transform: uppercase;
letter-spacing: 1%;
}
.border_section
{
border: 1px solid black;
background-color: black;
}
.one-third {
width: 27.35%;
float: left;
margin: 2% 0 3% 4%;
text-align: center;
background-color: white;
}
.guitarLogo img:hover
{
color: yellow;
background-color: blue;
}
footer{
font-family: 'Open Sans', sans-serif;
font-weight: bold;
text-align: center;
width: 100%;
height: 6%;
background-color: black;
overflow: auto;
}
footer p
{
margin-top: 1%;
color: white;
}
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/ibanezLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/fenderLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/gibsonLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/prsLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/ernieballLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/espLogo.jpg" runat="server"/>
</div>
</section>

If you don't want to affect other elements and change the background color of div element around your images, then create new class like myHover and add existing CSS to it, like:
HTML:
<div class="border_section myHover">
<img class="guitarLogo" src="../Images/Guitar Brands/fenderLogo.jpg" runat="server" />
</div>
CSS:
.myHover:hover {
color: yellow;
background-color: blue;
}
JSFiddle example: https://jsfiddle.net/59drat5e/4/

The selector would be img.guitarLogo:hover
But setting a background-color for an image will only affect the visible part around the image (if there is ANY), and color would only affect text (and there isn't any), so you will problably see no effect, even if it works.

It looks like that you are targeting the wrong element. The background-color:blue will only be visible if the image is transparent, otherwise most of the time the image will just overlap any background color for it to be visible.
What you should be doing is targetting the container element as shown below.
.border_section:hover
{
color: yellow;
background-color: blue;
}
DEMO
If you have images with transparencies or still if you want to set the background-color of the img just for the sake of it, then maybe you should write the rule as below.
img.guitarLogo:hover
{
color: yellow;
background-color: blue;
}

Try this code in your css
.guitarLogo:hover {
background: blue;
}

you can also overlay background color to image
.overlay {
position:relative;
width:400px;
height:auto;
}
.overlay img {
width:100%;
vertical-align:top;
}
.overlay:after {
content:'';
position:absolute;
width:100%;
height:100%;
top:0; left:0;
background:red;
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.overlay:hover:after {
opacity:1;
}
<div class="overlay">
<img src="https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" alt="" />
</div>

Your CSS:
.guitarLogo img:hover {
color: yellow;
background-color: blue;
}
Is incorrect, because the .guitarLogo already targets the <img> element - no need for img:hover.
Also, that isn't going to work, because there is no way you can set z-index to background only - it's possible only for elements.
The way to do what you want is to register :hover on parent container and in it by using pseudo element :before / :after as the foreground you can get the desired effect.

Related

Div alignment with content

I'm having some troubles to align the upper_navdiv with the content div.
I want the upper_nav with links aligned with the right-hand side margin and that grows in the left-hand side direction depending on how many links there are inside and the width of each boxes.
Could you check which is the problem?
upper_nav is child of header that takes the whole width of the page:
div#upper_nav {
position: absolute;
bottom:0;
right:0;
width:80%;
}
So I would that the width would be the 80% of the parent width but I don't understand why the margin is not aligned correctly.
Here the example of my page:
html {
margin: 0;
padding: 0;
background-color: #ffffff;
font-size: 17px;
}
body {
font-family: Tahoma, Geneva, sans-serif;
color: #000;
text-align: justify;
background-image: url('url_immagine');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
div#container {
overflow: hidden;
width: 95%;
margin: 0px auto;
background-color: #ffffff;
}
div#header {
/*background: url('header.png') no-repeat center center;*/
/*background-size: cover;*/
/*height:18vw;*/
position: relative;
}
div#upper_nav {
position: absolute;
bottom: 0;
right: 0;
width: 80%;
/*background-color:#e6e6e6;*/
}
div#navigation_left {
padding: 1% 1%;
float: left;
width: 21%;
background-color: #e6e6e6;
box-shadow: 5px 5px 2px #888888;
padding-bottom: 99999px;
margin-bottom: -99999px;
}
div#content {
overflow: auto;
margin-left: 25%;
background-color: #e6e6e6;
box-shadow: 5px 5px 2px #888888;
padding-left: 1%;
padding-right: 1%;
padding-bottom: 99999px;
margin-bottom: -99999px;
}
div#footer {
clear: both;
/*background: url('footer.png') no-repeat center center;*/
/*background-size: cover;*/
/*height:5vw;*/
width: 100%;
position: relative;
}
div#footer_content {
position: relative;
bottom: -50%;
text-align: center;
z-index: 9999;
background-color: #e6e6e6;
}
P {
color: #000;
font-family: Tahoma;
}
a {
text-decoration: none;
color: #0066FF;
font-size: 17px;
}
a:hover {
color: #0066FF;
text-decoration: underline
}
h1 {
background-color: #737373;
color: #fff;
font-family: verdana;
font-size: 200%;
}
h2,
h3,
h4,
h5,
h6,
h7,
h8 {
background-color: #737373;
color: #fff;
font-family: verdana;
font-size: 150%;
}
ul#menu_header {
list-style: none;
line-height: 150%;
text-align: center;
}
ul#menu_header li {
background-color: #737373;
right: 0;
width: 19.6%;
margin: 0.2%;
float: left;
/* elementi su singola riga */
}
ul#menu_header li a {
color: #fff;
text-decoration: none;
}
ul#menu_header li.active,
ul#menu_header li:hover {
background-color: #b1b1b1;
}
ul#menu_left {
display: block;
list-style: none;
text-align: left;
text-decoration: none;
padding-left: 5%;
}
ul#menu_left li {
margin: 1%;
font-size: 5vw;
}
ul#menu_left li a {
color: #000;
display: block;
line-height: 150%;
text-decoration: none;
}
ul#menu_left li.active,
ul#menu_left li:hover {
background-color: #c9c9c9;
}
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
.active,
.accordion:hover {
background-color: #ccc;
}
.panel {
padding: 0 18px;
display: none;
background-color: white;
overflow: hidden;
}
.panel a {
color: #000
}
.panel a:hover {
background-color: #b1b1b1
}
<html>
<head>
<title>Title</title>
</head>
<body>
<div id="container">
<div id="header">
<img src="http://placehold.it/1600x900" width="100%" alt="Riunione annuale GTTI SIEm2019" />
<div id="upper_nav">
<ul id="menu_header">
<li class="active">Home</li>
<li>Link11</li>
<li>Link22</li>
<li>Link33</li>
<li>Link44</li>
</ul>
</div>
</div>
<div id="navigation_left">
<ul id="menu_left">links</ul>
</div>
<div id="content">
<p>text</p>
</div>
<div id="footer">
<div id="footer_content"></div>
</div>
</div>
</body>
</html>
You notice the non-alignment resizing the window.

Element after other Element higher on page?

I can't get an element to go where I want it to. I am only having this problem because of the way I did my header. I applied position: absolute. You can see an example here: http://jacobgasser.com and you can find all the code on there, or you can read down a little farther and I put it there.
I want the text in the top left of the page to be on the white part of the page
Here is the index.html
<body onload="loadUp();">
<div class="menu">
<a href="https://github.com/jacobgasser" target="_blank"><div
class="menuItem">Projects</div></a>
</div>
<div class="titleBG">
<h1 class="title" onmouseover="coolThing();"onmouseout="notCoolThing();">Jacob Gasser</h1>
</div>
<div class="article">
<div class="articleHead">Who am I?</div>
</div>
<script src="scripts/main.js"></script>
</body>
Here is main.css
body {
margin:0;
padding:0;
}
.title {
color: white;
text-align: center;
font-size: 1000%;
opacity: 0;
-webkit-transition: 0.2s;
}
a {
text-decoration: none;
color: inherit;
}
.article {
font-family: "Arial";
display: inline-block;
padding: 5px 10px 5px 10px;
margin: 5px 10px 5px 10px;
text-align: center;
position: relative;
}
.articleHead {
display: inline-block;
padding: 5px 10px 5px 10px;
margin: 5px 10px 5px 10px;
}
.menu {
display: block;
color: white;
float: right;
margin-right: 10px;
margin-top: 5px;
opacity: 0;
}
.menuItem {
font-size: 400%;
display: block;
padding-left: 20px;
padding-right: 20px;
-webkit-transition: 0.2s;
border-radius: 5px;
}
.menuItem:hover {
background-color: white;
color: black;
cursor: pointer;
-webkit-transition: 0.2s;
}
.titleBG {
background-color: #23272A;
display: block;
width: 100%;
z-index: -1;
position: fixed;
top: 0;
}
::selection {
color: #23272A;
background-color: white;
}
::-moz-selection {
color: #23272A;
background-color: white;
}
#font-face {
font-family: lemon;
src: url("fonts/LemonMilk.otf");
}
#font-face {
font-family: cavs;
src: url("fonts/CaviarDreams.ttf");
}
A simple solution to this issue is to remove the position: fixed; top: 0; and adjust the margin-top and margin-bottom of the page. Just change the CSS for .titleBG and .title to be the following:
.titleBG {
background-color: #23272A;
display: block;
width: 100%;
z-index: -1;
}
.title {
color: white;
text-align: center;
font-size: 1000%;
opacity: 0;
-webkit-transition: 0.2s;
margin: 0 /* You can add a margin-left or margin-right if you want, or even margin-bottom, just keep the margin-top at 0*/;
}
This will give you the following result:

slide in text on image hover css

I'm trying to make a text appear on image hover, but will need it to slide in from top and cover only 50% of image height, but not sure how can I get this to work, here is the code
<img style="background-color:#3b283e; float:left;" src="images/f1.jpg" />
<div class="cags1">Traditional Pastry</div>
and the CSS
.cags1{
background-color: #3b283e;
float:left;
}
.cags1:hover > img {
opacity:0.5;
padding: 10px;
font-family: Tahoma,Arial,Helvetica;
font-size: 14px;
line-height: 30px;
letter-spacing: 1px;
text-align: center;
color: #ffffff;
text-shadow: 0 1px 3px #000000;
}
Here is a working example based on your code:
.img-container {
position: relative;
overflow: hidden;
display: inline-block;
}
.img-container img {
background-color:#3b283e;
float:left
}
.cags1 {
background-color: #3b283e;
position: absolute;
top: -20px;
transition: 0.5s;
}
.img-container:hover > img {
opacity:0.5;
padding: 10px;
font-family: Tahoma,Arial,Helvetica;
font-size: 14px;
line-height: 30px;
letter-spacing: 1px;
text-align: center;
color: #ffffff;
text-shadow: 0 1px 3px #000000;
}
.img-container:hover .cags1 {
top: 20px;
}
<div class="img-container">
<img src="https://dummyimage.com/150x75/992c99/313abd" />
<div class="cags1">Traditional Pastry</div>
</div>

How can I create this bar with a circle?

I am trying to create a style using CSS and HTML.
My style is like this:
I tried it and this is my HTML :
<div class="download-content">
<div class="download-item">
<div class="download-file">
<div class="front-number">1</div>
<p>Financial Ratio Analysis</p>
<small><span>2013-01-12</span><span>Format | Power Point</span></small>
</div>
</div>
</div>
This is my CSS :
.download-content > .download-item > .download-file {
background: #027bc6;
float: right;
width: 100%;
}
.download-content > .download-item > .download-file > .front-number {
background: none repeat scroll 0 0 #000;
border: 5px solid #fff;
border-radius: 50%;
color: #fff;
float: left;
font-size: 40px;
font-weight: bold;
height: 70px;
text-align: center;
width: 70px;
}
It was so close to my expected result. But not 100%.
JS FIDDLE
My two cents:
http://jsfiddle.net/coma/jBx76
HTML
<div class="files">
<a href="#">
<div>
<div class="name">Financial Ratio Analysis</div>
<div class="meta">
<div class="date">2014-08-25</div>
<div class="format">Word</div>
</div>
</div>
</a>
<a href="#">
<div>
<div class="name">Financial Ratio AnalysisFinancial Ratio Analysis (this name is so so so long long long long long long)</div>
<div class="meta">
<div class="date">2014-08-25</div>
<div class="format">PDF</div>
</div>
</div>
</a>
</div>
CSS
html {
font-family: Arial, Helvetica, sans-serif;
}
div.files {
position: relative;
display: block;
padding: 4px 4px 4px 0;
text-decoration: none;
counter-reset: file;
}
div.files a {
position: relative;
display: block;
padding: 4px 4px 4px 62px;
text-decoration: none;
counter-increment: file;
}
div.files a:before {
content: counter(file);
display: block;
position: absolute;
top: 2px;
left: 2px;
width: 68px;
height: 68px;
border: 5px solid #fff;
background-color: #000;
border-radius: 50%;
text-align: center;
line-height: 72px;
color: #fff;
font-size: 40px;
font-weight: bold;
}
div.files div {
line-height: 1em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
div.files a > div {
padding: 14px 14px 14px 28px;
background-color: #017BC6;
}
div.files .name {
margin: 0 0 14px 0;
font-size: 18px;
color: #fff;
}
div.files .meta {
font-size: 14px;
color: #bebfba;
font-weight: bold;
}
div.files .meta:after {
content: "";
display: block;
clear: both;
}
div.files .date {
float: left;
}
div.files .format {
float: right;
}
div.files .format:before {
content: "Format | ";
}
Hover
http://jsfiddle.net/coma/jBx76/4/
div.files a > div,
div.files a:before {
transition: background-color 350ms;
}
div.files a:hover > div {
background-color: #000;
}
div.files a:hover::before {
background-color: #017BC6;
}
Better browser support
http://jsfiddle.net/coma/jBx76/5/
Here's my shot at a solution. You need to move .front-number outside .download-file for it to work, though.
<div class="download-content">
<div class="download-item">
<div class="front-number">1</div>
<div class="download-file">
<p>Financial Ratio Analysis</p>
<small><span>2013-01-12</span><span>Format | Power Point</span></small>
</div>
</div>
</div>
.download-content > .download-item {
position: relative;
height: 80px
}
.download-content > .download-item > * {
position: absolute;
}
.download-content > .download-item > .front-number {
background: none repeat scroll 0 0 #000;
border: 5px solid #fff;
border-radius: 50%;
color: #fff;
float: left;
font-size: 40px;
font-weight: bold;
height: 70px;
text-align: center;
width: 70px;
z-index: 2;
}
.download-content > .download-item > .download-file {
background: #027bc6;
width: calc(100% - 110px);
height: 78px;
top: 1px;
left: 45px;
padding-left: 50px;
padding-right: 15px;
}
.download-content > .download-item > .download-file p,
.download-content > .download-item > .download-file a {
color: #fff;
text-decoration: none;
}
.download-content > .download-item > .download-file p {
font-size: 22px;
margin: 10px 0px;
}
.download-content > .download-item > .download-file small {
height: 1em;
line-height: 1em;
display: block;
}
.download-content > .download-item > .download-file small span:first-child {
float:left;
}
.download-content > .download-item > .download-file small span:last-child {
float:right;
}
JSBin
You can achieve the bar with circle effect by using a radial-gradient also (like in below snippet).
Radial gradients work on almost all latest browsers. You can see the full browser support chart here.
.download-content > .download-item > .download-file {
float: right;
width: 100%;
background: #027bc6;
background: radial-gradient(circle at 0% 50%, transparent 60px, #027bc6 60px);
}
.download-content > .download-item > .download-file > .front-number {
float: left;
height: 70px;
width: 70px;
font-size: 40px;
font-weight: bold;
text-align: center;
line-height: 70px;
color: #fff;
background: none repeat scroll 0 0 #000;
border: 5px solid #fff;
border-radius: 50%;
}
.download-file p a {
padding-left: 10px;
color: #fff;
font-size: 20px;
text-decoration: none;
}
span {
color: #AAAAAA;
font-weight: bold;
}
span.left {
float: left;
margin-left: 10px;
}
span.right {
float: right;
margin-right: 10px;
}
<!-- prefix free library to avoid browser prefixes -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class="download-content">
<div class="download-item">
<div class="download-file">
<div class="front-number">1</div>
<p>Financial Ratio Analysis</p>
<small><span class='left'>2013-01-12</span><span class='right'>Format | Power Point</span></small>
</div>
</div>
</div>
In the snippet, I have also done the following changes to make the output match the image in question:
Added line-height: 70px; (equal to the circle height) to vertically center the number
Made the following HTML and CSS changes to position and style your p and small contents.
HTML:
<span class='left'>2013-01-12</span><span class='right'>Format | Power Point</span>
CSS:
.download-file p a{
padding-left: 10px;
color: #fff;
text-decoration: none;
font-size: 20px;
}
span{
color: #AAAAAA;
font-weight: bold;
}
span.left{
float: left;
margin-left: 10px;
}
span.right{
float: right;
margin-right: 10px;
}
With CSS and HTML not exact like as image given is seems to be achievable, but here i given one solution hope it will helps you.
.download-content > .download-item > .download-file {
background: #027bc6;
float: right;
width: 100%;
border-radius:48px 0px 0px 48px;
}
.download-content > .download-item > .download-file > .front-number {
background: none repeat scroll 0 0 #000;
border: 10px solid #fff;
border-radius: 50%;
color: #fff;
float: left;
font-size: 40px;
font-weight: bold;
height: 70px;
text-align: center;
width: 70px;
line-height:68px;
margin: -2px;
}
JsFiddle
There's a lot of answers, but here's what I came up with.
jsbin
CSS:
.download-content > .download-item > .download-file {
background: #027bc6;
float: right;
width: 60%;
position: relative;
padding: 0 0 0 60px;
}
.download-content > .download-item > .download-file > .front-number {
background: none repeat scroll 0 0 #000;
border: 5px solid #fff;
border-radius: 50%;
color: #fff;
float: left;
font-size: 40px;
font-weight: bold;
line-height: 70px;
height: 70px;
text-align: center;
width: 70px;
position: absolute; left: -25px; top: -4px;
}
.download-file {
height: 70px;
}
.download-file p {
margin: 5px 0 10px 0;
}
.download-file > p > a {
color: #fff;
font-size: 22px;
font-weight: bold;
text-decoration: none;
}
.details {
display: inline-block;
color: #c0c0c0;
margin: 0 20px 0 0;
}
.left {
font-weight: bold;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="download-content">
<div class="download-item">
<div class="download-file">
<div class="front-number">1</div>
<p class="title">Financial Ratio Analysis</p>
<div class="details left">2013-01-12</div>
<div class="details">Format | Power Point</div>
</div>
</div>
</div>
</body>
</html>
Using a gradient and pseudo element it is possible
JSFiddle Demo
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
text-align: center;
}
.download-file {
margin: 25px;
display: inline-block;
}
.download-file > .front-number {
background: none repeat scroll 0 0 #000;
border-radius: 50%;
color: #fff;
display: inline-block;
font-size: 40px;
font-weight: bold;
height: 70px;
line-height: 70px;
text-align: center;
width: 70px;
vertical-align: top;
}
.box {
display: inline-block;
vertical-align: top;
height:70px;
color:white;
background: blue;
margin-left: 35px;
position: relative;
}
.box:before {
content:"";
position: absolute;
left:0;
top:0;
width:70px;
height:70px;
-webkit-transform:translateX(-100%);
transform:translateX(-100%);
background-image: -webkit-radial-gradient(left center, circle, transparent 0%, transparent 50%, blue 50%, blue);
background-image: -moz-radial-gradient(left center, circle, transparent 0%, transparent 50%, blue 50%, blue);
background-image: radial-gradient(left center, circle, transparent 0%, transparent 50%, blue 50%, blue);
}
I can offer you a "classical" approach with float and static position, divs, CSS, margins etc. In order to get the blue shape precisely, you could also use SVG or a combination of divs with CSS radiuses etc.
http://jsbin.com/cuvitixa/3/edit
What have I done:
1) I separated the background into an additional div and the content you've had before. The div is blue and is behind the text. As it has a margin-left, its edge is shifted below the circle and so it gets its shape.
HTML:
<div class="download-item">
<div class="download-item-bg"> </div>
...
CSS:
.download-item-bg {
float: left;
width: 280px;
height: 80px;
margin-left: 56px;
background: #027bc6;
padding-right: 10px;
}
2) As the new background box shifts down the content, I've pulled the content up.
.download-file {
float: left;
margin-top: -80px; /* pull the content over the blue background */
}
3) Set line-height in order to have the big number vertically in the middle.
.download-content > .download-item > .download-file > .front-number {
...
height: 70px;
line-height: 70px; /* set the number in the middle */
...
4) Different details just as an inspiration: Text color etc. Added classes to the spans, link text decoration etc etc:
HTML:
<span class="subtext bold">2013-01-12</span>
<span class="subtext pull-right">Format | Power
CSS:
.subtext {
color: #dddddd;
font-family: verdana;
font-size: 0.7em;
float: left;
}
.bold {
font-weight: bold;
}
.pull-right {
float: right;
}
...
.download-content > .download-item > .download-file a {
font-family: verdana; /* Similar :-) */
text-decoration: none;
color: white;
}
It's also commented online.
EDIT:
Removed a box that was not necessary and added more CSS font decoration in order to imitate as much as possible the original. Added code along with the JS Bin link.
Demo
html
<div class="circ">1</div>
<div class="rect">
<p class="title">Financial Ratio Analysis</p>
<p class="left">2013-01-12</p>
<p class="right">Format | Power Point</p>
</div>
css
body {
font-family: calibri;
}
.circ {
text-align: center;
font-size: 36px;
line-height: 72px;
color: white;
width: 74px;
height: 74px;
border-radius: 100%;
background: #000;
display: inline-block;
z-index: 11;
position: relative;
vertical-align: middle;
}
.rect {
color: white;
margin-left: -40px;
width: 300px;
height: 80px;
background: #00f;
position: relative;
display: inline-block;
z-index: 1;
vertical-align: middle;
}
.rect:before {
content:"";
width: 40px;
height: 80px;
background: #fff;
border-radius: 0 40px 40px 0;
position: absolute;
top:0;
left:0;
}
p {
margin:10px 5px 2px 50px;
}
.title {
font-size: 24px;
line-height: 24px;
font-weight: bold;
}
.left {
float: left;
font-size: 14px;
font-weight: bold;
color: #aaa;
}
.right {
float: right;
font-size: 14px;
font-weight: bold;
color: #aaa;
}
<small><span>2013-01-12</span><span style="float:right;padding-right:10px;"> Format | Power Point</span></small>

Image is displayed unusually big when inside a page

I have this image:
http://www.problemio.com/img/phoneimage.png
But when I placed in inside a page like this:
<div style="float:left">
<img src="https://i.stack.imgur.com/83Z5U.png" style="border: none;" />
</div>
<div style="float:left">
<p>
Some text
</p>
<p>
Some text
</p>
</div>
It got displayed as very big. Here is how it looks on a test page:
http://problemio.com/business/business_economics.php
Would anyone know why that happened? It is really unexpected. Here is the css I am working with
/* layout styles across the problemio project */
html
{
background-color: #ECE5B6;
#4a4647;
}
body, html
{
padding: 5px;
}
body
{
font-family: "Century Gothic",Helvetica,Arial,sans-serif;
margin: 0;
padding: 0;
font-size: 1.3em;
#background-color: #5C5957;
#background-color: #4a4647;
#background:url(/img/ui/background_image.png) top left no-repeat;
#background-size: 100%;
}
/* makes the background of the top bar gray */
.container
{
position: relative;
background-color: white;
overflow:hidden;
width:1000px;
margin: 0 auto;
-moz-border-radius: 15px;
border-radius: 15px;
}
.container_home
{
position: relative;
background-color: white;
overflow:hidden;
width:1000px;
margin: 0 auto;
}
div#bd
{
/* background-color: #f5f6f6; */ /* some form of gray */
background-color: white;
border-style:solid;
border-width:1px;
}
/* styles for banner: */
.banner
{
position: relative;
height: 40px;
background-size:100%;
#background-color: #4a4647;
}
.site_title
{
float:left;
margin-top: -3px;
margin-left: 10px;
font-weight: bold;
color: #ffce2e;
text-shadow: 2px 2px 2px rgba(0,0,0,0.8);
font-size:2.5em;
text-align: left
text-color: black;
width: 300px;
}
.site_login
{
width: 700px;
float:right;
position: absolute;
right: 10px;
bottom: 10px;
font-size: 90.0%;
color: gray;
text-align: right;
text-align: bottom;
}
/*
.bgdiv
{
position:absolute;
right:0px;
left:240px;
top:0px;
bottom:0px;
background-image: url('http://www.problemio.com/img/ui/banner_background.png');
#background-repeat: no-repeat;
}
*/
/* styles for basic template */
.content .basic
{
background: #fff;
padding: 15px;
border: 1px solid #888;
border-color: gray;
text-align: left;
}
.content .basic h1{
font-size: 2em;
font-weight:bold;
text-align: center;
}
.content .basic h2{
font-size: 1.5em;
font-weight:bold;
}
.content .basic h3{
font-size: 1.0em;
font-weight: bold;
}
#layout
{
/*margin:auto; */
#margin-top: 5px;
padding-right: 20px;
padding-left: 20px;
text-align:left;
/* background-color: #EDEDED; */
}
label span
{
float: left;
width: 15em;
}
p.half_text
{
font-size: 80.0%;
font-type: arial;
}
span.half_text
{
font-size: 80.0%;
font-type: arial;
}
p.half_height
{
margin: 5px 0;
}
.index_problem_title:visited
{
font-weight:bold;
text-decoration: none;
}
.index_problem_title
{
font-weight:bold;
text-decoration: none;
}
.index_problem_title:hover
{
text-decoration:underline;
color: gray;
}
footer a
{
color: white;
}
div.footer
{
text-align: right;
#color:#999999;
color: white;
background-color: black;
font-family:arial,times,serif;
font-size:18px;
#padding-top:20px;
line-height:150%;
position:relative;
float:right;
bottom:10px;
#height: 100px;
style: clear:both;
width: 1000px;
#background:url(/img/ui/footerbar.png) top left no-repeat;
}
#tabs-1
{
padding-left: 10px; !important;
}
.ui-tabs-panel
{
padding: 5px !important;
}
.ui-widget-header
{
background-image: none;
background-color: #EBEBEB;
padding-left: 50px;
}
.ui-state-default
{
background-image: none;
background-color: Gray;
}
To make adjacent,
<div style="float: left; width: 68%; display: inline;">
<img width="60%" height="60%" style="border: none;" src="http://www.problemio.com/img/phoneimage.png">
</div>
<div style="display: inline; float: left; width: 28%;">
<p>
Understanding and correctly forecasting the unit economics of your business is extremely important. It is a large part of a successful business plan, and the business itself. The term might sound complicated, but it is surprisingly simple. At least we will try to make it so with an example.
</p>
<p>
In an effort to make this material easy and fun to understand, we will actually go over the unit economics of a real business. Our example business: A single-location exercise gym. We will call it Bob's Fitness.
</p>
</div>
Actually , I just added some inline css to your code,you can made them in class or id also
#layout div img
{
max-width: 100%;
width: 100%;
}
Add this css in your page or place as you want.
I see you are modifying it :-) i'm testing with firebug!
In any case I tested it there
http://jsfiddle.net/eb56N/2/
I've just added
<img style="border: none; width: 100%;" src="http://www.problemio.com/img/phoneimage.png">
Maybe you already changed something.