Unsure how to use border-bottom in CSS - html

what I'd like to achieve is a border-bottom 20px below my h1 tag in my sidebar and also have 20px of "white space" below my border-bottom. I'd also like to have this underneath my h1 tag in my content area.
Here's the link to what I have now
HTML:
<!-- SIDEBAR -->
<div id="sidebar">
<h1>Caul / Cbua</h1>
<div class="sidetext">
Lorem ipsumdolor sit amet, consectetur adipiscing elit. Nam laoreet mi c est dignissim, at auctor mi tristique.
</div>
<h1>Commit</h1>
<div class="sidelink">
<ul>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
</ul>
</div>
</div>
<!-- CONTENT -->
<div id="content">
<h1>News</h1>
<div class="article">
<img class="articleimg" src="../../Slicing Images/news images/caul.png" width="84" height="65" alt="caul" />
<h2>Lorem Ipsum</h2>
<h3>Friday, August 16th</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque a leo in lacus tempor egestas. Maecenas faucibus neque nisi, eu condimentum enim porta id. Suspendisse blandit sem tellus. Vivamus tristique, nunc faucibus pulvinar fringilla, sem ipsum molestie libero, id rhoncus turpis quam sit amet quam. </p>
</div>
<div class="article">
<img class="articleimg" src="../../Slicing Images/news images/caul.png" width="84" height="65" alt="caul" />
<h2>Lorem Ipsum</h2>
<h3>Friday, August 16th</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque a leo in lacus tempor egestas. Maecenas faucibus neque nisi, eu condimentum enim porta id. Suspendisse blandit sem tellus. Vivamus tristique, nunc faucibus pulvinar fringilla, sem ipsum molestie libero, id rhoncus turpis quam sit amet quam. </p>
</div>
</div>
CSS:
#sidebar {
background-color: #e7d9c9;
background-image: url('/imgs/map.png');
background-repeat: no-repeat;
position: absolute;
/* # */
height: 100%;
width: 318px;
float: left;
padding-bottom: 20px;
padding-top: 20px;
}
#sidebar h1 {
border-bottom: thick;
border-bottom-width: 75%;
}
.sidetext {
padding: 5px 20px;
font-size: 18px;
font-family: Helvetica Neue;
padding-bottom: 20px;
}
.sidelink {
padding-bottom: 20px;
margin: 0;
padding: 0;
width:300px;
}
.sidelink ul {
margin: 0;
padding: 0;
margin-left: 20px;
}
.sidelink li {
display: block;
list-style: none;
}
.sidelink li a {
display:block;
font-family: Helvetica Neue;
font-size:16px;
color:#FFF;
text-decoration:none;
background-color:#1e416f;
padding:5px;
border-left:10px solid #FFF;
padding-bottom: 20px;
}
.sidelink li a:hover {
border-left:14px solid #1e416f;
background-color:#e7d9c9;
color: #1e416f;
}
h5 {
font-family: Helvetica Neue: Light;
font-size: 24px;
color: #517f9c;
}
/* Content */
#content {
width: 642px;
float: right;
padding-top: 20px;
}
.article {
padding: 5px 20px;
}
.articleimg {
float: left;
padding-right: 25px;
}

Try this and see how you go
#sidebar h1 { border-bottom: 1px solid black; margin-bottom: 20px; }

h1 {
border-bottom: 20px solid #000000;
}
AND
h1 {
margin: 0 0 20px 0;
}
OR
h1 {
margin-bottom: 20px;
}
Combine both rules though... So more like this:
h1 {
margin: 0 0 20px 0;
border-bottom: 20px solid #000000;
}

#sidebar h1 { border-bottom: 20px solid black; margin-bottom: 20px; }
If you want it for all h1
h1 { border-bottom: 20px solid black; margin-bottom: 20px; }

Try this CSS:
div > h1 { border-bottom: 20px solid black; margin-bottom: 20px; }

Related

html css outer div text align center, inside div text align left

there is a box with text, at the right of the box there is an image
The box of text is have z index higher than image, so box of text look like in front of image
I used text-align center, to center all components inside div, and this is a must
Now I want the only text, only the text in box of text is align left
How can I achieve this?
.button-yellow, .button-red {
font: 16px AdobeCaslonPro;
text-decoration: none;
padding: 6px 12px 6px 12px;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-radius: 4px;
moz-border-radius: 4px;
webkit-border-radius: 4px;
font-style: italic;
}
.button-yellow {
background-color: #ccb96b;
color: #430615;
}
.button-red {
background-color: #430615;
color: #ccb96b;
margin-top: -20px;
}
#section-welcome-content {
text-align: center;
}
#welcome-content{
width: 45%;
margin: 0 0 0 0 ;
}
#welcome-content-inner {
background-color: #ccb96b;
color: #430615;
padding: 50px;
z-index: 10;
position: relative;
}
#welcome-content p{
}
#crop {
width: 600px;
height: 500px;
overflow: hidden;
margin: 0 0 0 -50px ;
}
#crop img {
width: 800px;
height: 600px;
margin: -75px 0 0 -100px;
z-index: 1;
}
<section id="section-welcome-content" class="pad">
<div id="welcome-content" style=" display: inline-block; " >
<div id="welcome-content-inner" >
<p>
<h3 style="font-size: 1.5em; text-transform: uppercase;"> <i>Lorem ipsum</i> </h3>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum, eu facilisis justo sollicitudin.
<br><br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum, eu facilisis justo sollicitudin.
<br><br><br>
Read more
</p>
</div>
<div>
</div>
<div>
</div>
</div>
<div id="crop" style=" display: inline-block; ">
<img src="http://media.caranddriver.com/images/media/51/2017-10best-lead-photo-672628-s-original.jpg" alt="" style=" "/>
</div>
</section>
Any help appreciated
My answer comprises of 2 scenarios so it can help you the way you want. So you can choose the best way you want. I have also included live example so you can easily check it .
1. For all text inside to be on left, which includes both heading and text. Add this css
/* For All Left */
#welcome-content-inner {
text-align: left;
}
.button-yellow,
.button-red {
font: 16px AdobeCaslonPro;
text-decoration: none;
padding: 6px 12px 6px 12px;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-radius: 4px;
moz-border-radius: 4px;
webkit-border-radius: 4px;
font-style: italic;
}
.button-yellow {
background-color: #ccb96b;
color: #430615;
}
.button-red {
background-color: #430615;
color: #ccb96b;
margin-top: -20px;
}
#section-welcome-content {
text-align: center;
}
#welcome-content {
width: 45%;
margin: 0 0 0 0;
}
#welcome-content-inner {
background-color: #ccb96b;
color: #430615;
padding: 50px;
z-index: 10;
position: relative;
}
#welcome-content p {}
#crop {
width: 600px;
height: 500px;
overflow: hidden;
margin: 0 0 0 -50px;
}
#crop img {
width: 800px;
height: 600px;
margin: -75px 0 0 -100px;
z-index: 1;
}
/* For All Left */
#welcome-content-inner {
text-align: left;
}
<section id="section-welcome-content" class="pad">
<div id="welcome-content" style=" display: inline-block; ">
<div id="welcome-content-inner">
<p>
<h3 style="font-size: 1.5em; text-transform: uppercase;"> <i>Lorem ipsum</i> </h3>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum, eu facilisis justo
sollicitudin.
<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum,
eu facilisis justo sollicitudin.
<br><br><br>
Read more
</p>
</div>
<div>
</div>
<div>
</div>
</div>
<div id="crop" style=" display: inline-block; ">
<img src="http://media.caranddriver.com/images/media/51/2017-10best-lead-photo-672628-s-original.jpg" alt="" style=" " />
</div>
</section>
2. For only text to be on left and heading on center. Add this css.
/* For only text Left and heading center */
#welcome-content-inner {
text-align: left;
}
#welcome-content-inner h3 {
text-align: center;
}
.button-yellow,
.button-red {
font: 16px AdobeCaslonPro;
text-decoration: none;
padding: 6px 12px 6px 12px;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-radius: 4px;
moz-border-radius: 4px;
webkit-border-radius: 4px;
font-style: italic;
}
.button-yellow {
background-color: #ccb96b;
color: #430615;
}
.button-red {
background-color: #430615;
color: #ccb96b;
margin-top: -20px;
}
#section-welcome-content {
text-align: center;
}
#welcome-content {
width: 45%;
margin: 0 0 0 0;
}
#welcome-content-inner {
background-color: #ccb96b;
color: #430615;
padding: 50px;
z-index: 10;
position: relative;
}
#welcome-content p {}
#crop {
width: 600px;
height: 500px;
overflow: hidden;
margin: 0 0 0 -50px;
}
#crop img {
width: 800px;
height: 600px;
margin: -75px 0 0 -100px;
z-index: 1;
}
/* For only text Left and heading center */
#welcome-content-inner {
text-align: left;
}
#welcome-content-inner h3 {
text-align: center;
}
<section id="section-welcome-content" class="pad">
<div id="welcome-content" style=" display: inline-block; ">
<div id="welcome-content-inner">
<p>
<h3 style="font-size: 1.5em; text-transform: uppercase;"> <i>Lorem ipsum</i> </h3>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum, eu facilisis justo
sollicitudin.
<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum,
eu facilisis justo sollicitudin.
<br><br><br>
Read more
</p>
</div>
<div>
</div>
<div>
</div>
</div>
<div id="crop" style=" display: inline-block; ">
<img src="http://media.caranddriver.com/images/media/51/2017-10best-lead-photo-672628-s-original.jpg" alt="" style=" " />
</div>
</section>
You just need to add text-align:left; in your welcome-content-inner div and you're there.
.button-yellow, .button-red {
font: 16px AdobeCaslonPro;
text-decoration: none;
padding: 6px 12px 6px 12px;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-radius: 4px;
moz-border-radius: 4px;
webkit-border-radius: 4px;
font-style: italic;
}
.button-yellow {
background-color: #ccb96b;
color: #430615;
}
.button-red {
background-color: #430615;
color: #ccb96b;
margin-top: -20px;
}
#section-welcome-content {
text-align: center;
}
#welcome-content{
width: 45%;
margin: 0 0 0 0 ;
}
#welcome-content-inner {
background-color: #ccb96b;
color: #430615;
padding: 50px;
z-index: 10;
position: relative;
text-align: left;
}
#welcome-content p{
}
#crop {
width: 600px;
height: 500px;
overflow: hidden;
margin: 0 0 0 -50px ;
}
#crop img {
width: 800px;
height: 600px;
margin: -75px 0 0 -100px;
z-index: 1;
}
<section id="section-welcome-content" class="pad">
<div id="welcome-content" style=" display: inline-block; " >
<div id="welcome-content-inner" >
<p>
<h3 style="font-size: 1.5em; text-transform: uppercase;"> <i>Lorem ipsum</i> </h3>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum, eu facilisis justo sollicitudin.
<br><br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris arcu sapien, dignissim id laoreet quis, sollicitudin sed dui. Mauris mauris ligula, hendrerit sed ligula vitae, viverra auctor eros. Duis rutrum dolor a felis elementum, eu facilisis justo sollicitudin.
<br><br><br>
Read more
</p>
</div>
<div>
</div>
<div>
</div>
</div>
<div id="crop" style=" display: inline-block; ">
<img src="http://media.caranddriver.com/images/media/51/2017-10best-lead-photo-672628-s-original.jpg" alt="" style=" "/>
</div>
</section>
Hope it helps.

Trying to use a div as a separator for different sections

Essentially I am trying to use the <Div> tag to create a bottom border to separate different content on the page but when I scroll to the bottom and insert the div there to separate them, it will ignore the other tags I have put and attached itself to the previous div separator.
How can I fix this? I tried using a HR tag but it did the same.
This is my code:
div {
margin: 0;
padding: 0;
}
#wrapper {
width: 100%;
margin: 0 auto;
}
#leftcolumn,
#rightcolumn {
border: none;
float: left;
min-height: 450px;
color: white;
}
#leftcolumn {
width: 50%;
}
.container {
margin-left: 10%;
width: 40%;
text-align: center;
}
#rightcolumn {
/* height: 100%;*/
width: 40%;
float: right;
background-color: #c9ccc9;
}
.border {
border-bottom: 40px solid #8dc43f;
}
p {
color: black;
}
.infotext {
color: #8dc43f;
margin-left: 30%;
font-family: 'ABeeZee', sans-serif;
font-size: 30px;
}
.infotexttitle {
color: #8dc43f;
margin-left: 25%;
font-family: 'ABeeZee', sans-serif;
font-size: 30px;
}
.infotexttitlepower {
color: #8dc43f;
margin-left: 36%;
font-family: 'ABeeZee', sans-serif;
font-size: 30px;
}
.infotexttitlecomm {
color: #8dc43f;
margin-left: 17%;
font-family: 'ABeeZee', sans-serif;
font-size: 30px;
}
.bluetags {
width: 264px;
padding: 0;
/* transform:rotate(180deg);*/
display: block;
/* border-collapse:collapse;*/
margin-left: 176px;
margin-top: 4px;
}
.greentags {
width: 264px;
padding: 0;
/* transform:rotate(180deg);*/
display: block;
/* border-collapse:collapse;*/
margin-left: 180px;
margin-top: -26px;
}
.orangetags {
width: 280px;
padding: 0;
/* transform:rotate(180deg);*/
display: block;
/* border-collapse:collapse;*/
margin-left: 175px;
margin-top: -15px;
}
.image {
position: relative;
width: 80%;
/* for IE 6 */
}
.titleimg {
margin-left: -60%;
margin-right: 10%;
}
imagetext {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
.bgimg {
background-size: cover;
width: 100%;
height: 60%;
border-collapse: collapse;
display: block;
margin: 0;
padding: 0;
}
#container {
height: 400px;
width: 400px;
position: relative;
}
#text {
z-index: 100;
position: absolute;
color: white;
font-size: 24px;
font-weight: bold;
left: 43%;
top: 25%;
font-family: 'ABeeZee', sans-serif;
}
#secondtext {
z-index: 100;
position: absolute;
color: white;
font-size: 24px;
font-weight: bold;
left: 37%;
top: 30%;
font-family: 'ABeeZee', sans-serif;
}
<div id="cssmenu">
<ul>
<img src="turtletag.png" class="titleimg">
<li><span>Home</span>
</li>
<li><span>Features</span>
</li>
<li><span>App</span>
</li>
<li><span>Products</span>
</li>
<li><span>Support</span>
</li>
</ul>
</div>
<img src="googlestore.png" style="position:absolute; top:210px;left:70px; width: 10%;">
<img src="appstore.png" style="position:absolute; top:320px; left:77px; width:10%;">
Order Tags
<img src="iPhone5_Mockup_Template_Free_by_Ray.png" class="bgimg">
<p id="text">Turtle Tags</p>
<p id="secondtext">Always connected to the nest</p>
<div class="border"></div>
<div id="leftcolumn">
<div class="mainbody">
<img src="bluetags.png" class="bluetags hvr-float">
</div>
<div class="mainbody">
<img src="greentags.png" class="greentags hvr-float">
</div>
<div class="mainbody">
<img src="orangetag.png" class="orangetags hvr-float">
</div>
</div>
<a name="features"></a>
<div id="rightcolumn">
<h2 class="infotext">Features</h2>
<hr class="newstyle">
<img src="battery.png" style="margin-left:40%; width:15%">
<p class="infotexttitle">Long battery life</p>
<p rows="4" columns="4" style="width:350px;margin-left:100px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna enim, aliquet non sagittis sit amet, euismod luctus risus. Aliquam venenatis arcu quam, id hendrerit dolor fermentum sed. Nullam congue molestie dolor quis egestas. Suspendisse
potenti.
</p>
<img src="speaker-xxl.png" style="margin-left:45%; width:10%; margin-top:30px;">
<p class="infotexttitle">Noise Notifications</p>
<p rows="4" columns="4" style="width:350px;margin-left:100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna enim, aliquet non sagittis sit amet, euismod luctus risus. Aliquam venenatis arcu quam, id hendrerit dolor fermentum sed. Nullam congue molestie dolor quis egestas. Suspendisse potenti.
</p>
<img src="powericon.png" style="margin-left:45%; width:10%; margin-top:30px;">
<p class="infotexttitlepower">Always on</p>
<p rows="4" columns="4" style="width:350px;margin-left:100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna enim, aliquet non sagittis sit amet, euismod luctus risus. Aliquam venenatis arcu quam, id hendrerit dolor fermentum sed. Nullam congue molestie dolor quis egestas. Suspendisse potenti.
</p>
<img src="twoway.png" style="margin-left:45%; width:10%; margin-top:30px;">
<p class="infotexttitlecomm">Two way communication</p>
<p rows="4" columns="4" style="width:350px; margin-left:100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna enim, aliquet non sagittis sit amet, euismod luctus risus. Aliquam venenatis arcu quam, id hendrerit dolor fermentum sed. Nullam congue molestie dolor quis egestas. Suspendisse potenti.
</p>
</div>
I've tried changing the css and I can't find anything that would cause it, But a fresh pair of eyes may be able to find something I cannot.
The problem here comes from how you constructed your page. You have a left/right column that was built using floats. when you use float, it takes the content in the float out of the general flow of the page. Try to remove those floats and it should work as expected.
I removed your floats in the fiddle and the border started working right.
https://jsfiddle.net/ahmadabdul3/ghogvcsx/4/
here's a basic idea on how floats work: the top boxes don't overlap because there is no float, but the bottom 2 boxes you only see green because the red one is floated so the green one takes its space. to avoid this, add an explicit height to the floated div, but then you can't have dynamically expanding content. https://jsfiddle.net/ahmadabdul3/bL8qLa6j/2/
and here's a basic idea of how columns work: https://jsfiddle.net/ahmadabdul3/bL8qLa6j/5/

html and css resposive website has abnormal styling

what is the problem? why the links is at not correct position?how can I keep the links in correct position after minimizing the browser also there is no separation between the links. why this happens?please rectify my css code. also how can I make it more resposive.
.body {
background-color: #E8E8E8;
color: 000305;
font-size: 87.5%;
/*Base font size 14px*/
font-family: arial, "Lucida Sans Unicode";
font-height: 1.5;
text-align: left;
margin: 0 auto;
width: 70%;
clear: both;
}
a {
text-decoration: none;
}
a:link,
a:visited {
color: #CF5C3F;
}
a:hover,
a:active {
background-color: #CF5C3F;
color: #FFF;
}
.mainHeader img {
width: 20%;
height: auto;
margin: 2% 0;
border-radius: 90px;
}
.mainHeader nav {
background-color: #666;
height: 40px;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.mainHeader nav ul {
list-style: none;
margin: 0 auto;
}
.mainHeader nav ul li {
float: left;
display: inline;
}
.mainHeader nav a:link,
.mainHeader nav a:visited {
color: #FFF;
display: inline-block;
padding: 10px 25px;
}
.mainHeader nav a:hover,
.mainHeader nav a:active,
.mainHeader nav .active a:link,
.mainHeader nav .active a:visited {
background-color: #CF5C3F;
height: 20px;
text-shadow: none;
}
.mainHeader nav ul li a {
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.mainContent {
line-height: 25px;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.content {
width: 70%;
float: left;
}
.topcontent {
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
padding: 3% 5%;
margin-top: 2%;
}
.bottomcontent {
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
padding: 3% 5%;
margin-top: 2%;
margin-bottom: 2%;
}
.top-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
margin-top: 2%;
}
.middle-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
}
.bottom-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
}
.mainFooter {
width: 100%;
float: left;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
background-color: #666;
margin-top: 2% margin-bottom: 2%;
height: 40%;
}
.mainFooter p {
margin: 10px auto;
width: 92%;
color: #FFF;
}
.postinfo {
font-style: italic;
color: #999;
font-size: 90%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<title>HTML5/CSS3 responsive theme</title>
</head>
<!--Body start here!-->
<body class="body">
<header class="mainHeader">
<!--Main logo of the page!-->
<img src="img/images.jpeg" alt="logo here">
<!-- Main navigation bar!-->
<nav>
<ul>
<li class="active"><a href="#">Home</li>
<li><a href="#">About </li>
<li><a href="#">Portofolio </li>
<li><a href="#">Contact </li>
</ul>
</nav>
</header>
<!--Main content starts here!-->
<div class="mainContent">
<div class="content">
<article class="topcontent">
<header>
<h2>First post
</h2>
</header>
<footer class="postinfo">
<p>This post is written by Christian</p>
</footer>
<content>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
</content>
</article>
<!--bottom content starts!-->
<article class="bottomcontent">
<header>
<h2>Second post</h2>
</header>
<footer class="postinfo">
<p>This post is written by Christian</p>
</footer>
<content>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
</content>
</article>
</div>
</div>
<!--This is the right side content!-->
<aside class="top-sidebar">
<article>
<h2>Top sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada</p>
</article>
</aside>
<aside class="middle-sidebar">
<article>
<h2>Top sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada</p>
</article>
</aside>
<aside class="bottom-sidebar">
<article>
<h2>Top sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada</p>
</article>
</aside>
<!--This should be the foot of the webpage!-->
<footer class="mainFooter">
<p>Copyright © 2016 1stwebdesinger.com
</p>
</footer>
</body>
</html>
You have some css and html issues in your code.
First close all <a href> tag and second remove float:left from .mainHeader nav ul li class and replace inline to inline-block so you won't need height to show background of nav.
After that you will see all menus are in one row but after resizing little bit more, menu will go down as no such space. For this issue you have to use Media query to solve or use bootstrap or navbar menu style.
You can read more about Media query or Bootstrap for responsiveness.
Check my Fiddle here.
* **Note : Whenever you are using float:left then try to use clear:both after that so there won't be any extra white gap/space however I have removed float from your code, so just side note. Hope it will help..
Changes in your style and html may it helps you
1- close your "a" tag
2- for repsponsive use style in
<style>
.body {
background-color: #E8E8E8;
color: 000305;
font-size: 87.5%;
/*Base font size 14px*/
font-family: arial, "Lucida Sans Unicode";
font-height: 1.5;
text-align: left;
margin: 0 auto;
width: 70%;
clear: both;
}
a {
text-decoration: none;
}
a:link,
a:visited {
color: #CF5C3F;
}
a:hover,
a:active {
background-color: #CF5C3F;
color: #FFF;
}
.mainHeader img {
width: 20%;
height: auto;
margin: 2% 0;
border-radius: 90px;
}
.mainHeader nav {
background-color: #666;
height: 40px;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.mainHeader nav ul {
list-style: none;
margin: 0 auto;
}
.mainHeader nav ul li {
float: left;
display: inline;
}
.mainHeader nav a:link,
.mainHeader nav a:visited {
color: #FFF;
display: inline-block;
padding: 10px 25px;
}
.mainHeader nav a:hover,
.mainHeader nav a:active,
.mainHeader nav .active a:link,
.mainHeader nav .active a:visited {
background-color: #CF5C3F;
height: 20px;
text-shadow: none;
}
.mainHeader nav ul li a {
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.mainContent {
line-height: 25px;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.content {
width: 70%;
float: left;
}
.topcontent {
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
padding: 3% 5%;
margin-top: 2%;
}
.bottomcontent {
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
padding: 3% 5%;
margin-top: 2%;
margin-bottom: 2%;
}
.top-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
margin-top: 2%;
}
.middle-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
}
.bottom-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
}
.mainFooter {
width: 100%;
float: left;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
background-color: #666;
margin-top: 2% margin-bottom: 2%;
height: 40%;
}
.mainFooter p {
margin: 10px auto;
width: 92%;
color: #FFF;
}
.postinfo {
font-style: italic;
color: #999;
font-size: 90%;
}
/*css for responsive */
#media (max-width:767px)
{
.mainHeader nav
{
box-sizing:border-box;
overflow:hidden;
}
.mainHeader nav ul li{
width:100%;
display:block;
float:none;
}
.mainHeader nav, .mainHeader nav a:hover, .mainHeader nav a:active, .mainHeader nav .active a:link, .mainHeader nav .active a:visited{
height:100%;
}
.mainHeader nav ul{
padding:0px 0px;
}
.mainHeader nav a:link, .mainHeader nav a:visited
{
width:100%;
}
.mainHeader nav ul li a{
border-radius:0px 0px;
}
}
</style>
<!--html-->
<nav>
<ul>
<li class="active">Home</li>
<li>About </li>
<li>Portofolio </li>
<li><a href="#">Contact </li>
</ul>
</nav>
Two problem what i have noticed in your code you are not closing the <a> tags
2nd setting the height on hover are never a good practice. on hover links height increases that's why such things happening. see snippet
UPDATED CODE TRY MEDIA QUERY
#media all and (max-width: 768px) {
.mainHeader nav a:link, .mainHeader nav a:visited {
font-size:80%;
padding: 10px 15px;
}
/**MORE CODE FOR WIDTH 0 to 768px**/
}
.body {
background-color: #E8E8E8;
color: 000305;
font-size: 87.5%;
/*Base font size 14px*/
font-family: arial, "Lucida Sans Unicode";
font-height: 1.5;
text-align: left;
margin: 0 auto;
width: 70%;
clear: both;
}
a {
text-decoration: none;
}
a:link,
a:visited {
color: #CF5C3F;
}
a:hover,
a:active {
background-color: #CF5C3F;
color: #FFF;
}
.mainHeader img {
width: 20%;
height: auto;
margin: 2% 0;
border-radius: 90px;
}
.mainHeader nav {
background-color: #666;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.mainHeader nav ul {
list-style: none;
margin: 0 auto;
}
.mainHeader nav ul li {
float: left;
display: inline;
}
.mainHeader nav a:link,
.mainHeader nav a:visited {
color: #FFF;
display: inline-block;
padding: 10px 25px;
}
.mainHeader nav a:hover,
.mainHeader nav a:active,
.mainHeader nav .active a:link,
.mainHeader nav .active a:visited {
background-color: #CF5C3F;
text-shadow: none;
}
.mainHeader nav ul li a {
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.mainContent {
line-height: 25px;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
}
.content {
width: 70%;
float: left;
}
.topcontent {
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
padding: 3% 5%;
margin-top: 2%;
}
.bottomcontent {
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
padding: 3% 5%;
margin-top: 2%;
margin-bottom: 2%;
}
.top-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
margin-top: 2%;
}
.middle-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
}
.bottom-sidebar {
width: 21%;
float: left;
background-color: #FFF;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
margin-left: 3%;
padding: 2%;
margin-bottom: 2%;
}
.mainFooter {
width: 100%;
float: left;
border-radius: 5px;
moz-border-radius: 5px;
webkit-border-radius: 5px;
background-color: #666;
margin-top: 2% margin-bottom: 2%;
height: 40%;
}
.mainFooter p {
margin: 10px auto;
width: 92%;
color: #FFF;
}
.postinfo {
font-style: italic;
color: #999;
font-size: 90%;
}
#media all and (max-width: 768px) {
.mainHeader nav a:link, .mainHeader nav a:visited {
font-size:80%;
padding: 10px 15px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<title>HTML5/CSS3 responsive theme</title>
</head>
<!--Body start here!-->
<body class="body">
<header class="mainHeader">
<!--Main logo of the page!-->
<img src="img/images.jpeg" alt="logo here">
<!-- Main navigation bar!-->
<nav>
<ul>
<li class="active">Home</li>
<li>About </li>
<li>Portofolio </li>
<li><a href="#">Contact </li>
</ul>
</nav>
</header>
<!--Main content starts here!-->
<div class="mainContent">
<div class="content">
<article class="topcontent">
<header>
<h2>First post
</h2>
</header>
<footer class="postinfo">
<p>This post is written by Christian</p>
</footer>
<content>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
</content>
</article>
<!--bottom content starts!-->
<article class="bottomcontent">
<header>
<h2>Second post</h2>
</header>
<footer class="postinfo">
<p>This post is written by Christian</p>
</footer>
<content>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada ac lacinia vel, vulputate sit amet arcu. Aliquam quis congue nulla. Nulla egestas nisl risus, accumsan
iaculis sem scelerisque vel. Praesent sit amet risus efficitur, rhoncus nisi quis, tincidunt dui. Duis consequat.</p>
</content>
</article>
</div>
</div>
<!--This is the right side content!-->
<aside class="top-sidebar">
<article>
<h2>Top sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada</p>
</article>
</aside>
<aside class="middle-sidebar">
<article>
<h2>Top sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada</p>
</article>
</aside>
<aside class="bottom-sidebar">
<article>
<h2>Top sidebar</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec aliquet interdum elit, id ultricies leo pretium id. Aenean erat risus, malesuada</p>
</article>
</aside>
<!--This should be the foot of the webpage!-->
<footer class="mainFooter">
<p>Copyright © 2016 1stwebdesinger.com
</p>
</footer>
</body>
</html>

How can I make my layout more responsive?

Ok guys I have styled this very well, but there are a few quirks! I have tried everything and it looks great/good as a responsive site, but there are some issues. I cannot get the .therapy section to look the way I want it to. Full page it hugs the left margin, but looks good with my media queries. My question is how do i get it to look good on full page and be responsive as well. Thanks and hugs. I would like the margins to come in a few px and look like it is not using all the white space available. please help.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Home</title>
<link rel="stylesheet" href="something.css" type="text/css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
body{
background-color: #f1f0d1;
font-family: Verdana, Tahoma, Arial, sans-serif;
font-size: 1.125em;
overflow: auto;
}
h1, h2, h3{
text-align: center;
padding-left: 5%;
color: #878e63;
}
p{
padding: 2%;
color: #878e63;
}
img{
text-align: center;
max-width: 100%;
height: auto;
width: auto;
}
#wrapper {
margin: 0 auto;
max-width: 1020px;
width: 98%;
background-color: #fefbe8;
border: 1px solid #878e63;
border-radius: 2px;
box-shadow: 0 0 10px 0px;
overflow: hidden;
}
#callout {
width: 100%;
height: auto;
background-color: #878e63;
overflow: hidden;
}
#callout p {
text-align: right;
font-size: 13px;
padding: 0.1% 5% 0 0;
color: #f1f0d1;
}
#callout p a {
color: #f1f0d1;
text-decoration: none;
}
header {
width: 96%
min-height: 125px;
padding: 5px;
text-align: center;
}
nav ul {
list-style-type: none;
margin: 0;
padding-left: 90px;
}
nav ul li {
float: left;
border: 1px solid #878e63;
width: 15%;
}
nav ul li a {
background-color: #f1f0d1;
display: block;
padding: 5% 12%;
font-weight: bold;
font-size: 18px;
color: #878e63;
text-decoration: none;
text-align: center;
}
nav ul li a:hover, nav ul li.active a {
background-color: #878e63;
color: #f1f0d1;
}
.banner img {
width: 100%;
border-top: 1px solid #878e63;
border-bottom: 1px solid #878e63;
}
.clearfix{
clear: both;
}
.left-col {
width: 55%;
float: left;
margin: 1% 1% 1%;
}
.sidebar: {
width: 40%;
float: right;
margin: 1%;
text-align: center;
}
.therapy {
/*float: left;*/
margin: 0 auto;
width: 100%;
height: auto;
/*padding: 1%;*/
}
.section{
width: 29%;
float: left;
margin: 2% 2%;
text-align: center;
}
footer{
background-color: #878e63;
width: 100%;
overflow: hidden;
}
footer p, footer h3 {
color: #f1f0d1;
}
footer p a {
color: #f1f0d1;
text-decoration: none;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
display: inline;
}
ul li img {
height: 50px;
}
#media screen and (max-width: 480px) {
body{
font-size: 13px;
}
}
#media screen and (max-width: 740px){
nav {
width: 100%;
margin-bottom: 10px;
}
nav ul {
list-style-type: none;
margin: 0 auto;
padding-left: 0;
}
nav ul li {
text-align: center;
margin-left: 0 auto;
width: 100%;
border-top: 1px solid #878e63;
border-right: 0px solid #878e63;
border-bottom: 1px solid #878e63;
border-left: 0px solid #878e63;
}
nav ul li a{
padding: 8px 0;
font-size: 16px;
}
.left-col, .sidebar, .section {
width: 100%;
float: left;
margin: 0;
}
}
</style>
</head>
<!-- redo all images on the page and style with css3-->
<body>
<div id="wrapper">
<div id="callout">
<p>Call us at <strong>727-555-5555</strong></p>
</div><!--end callout div-->
<header>
<!--need ne image--><img src="http://www.w3newbie.com/wp-content/uploads/massagelogo.png" alt="Massage" title="Massage by ?">
</header>
<nav>
<ul>
<li class="active">Home</li>
<!--make active later--><li>Contact</li>
<!--make active later--><li>Pricing</li>
<!--make active later--><li>Specials</li>
<!--make active later--><li>Consult</li>
<!--make active later--><li>Consult</li>
</ul>
<div class="clearfix"></div>
</nav>
<div class="banner">
<img src="http://www.w3newbie.com/wp-content/uploads/massagebanner.png" alt="need new" title="new">
</div><!--close banner-->
<!--fix w css--><center><img src="http://www.w3newbie.com/wp-content/uploads/three_sayings.png" alt="need new" title="new"></center>
<section class="left-col">
<!--use h2 tag and css--><p style="text-indent: 50px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non fringilla risus. Quisque sollicitudin iaculis nunc, ultricies fringilla ex malesuada eu. Quisque a augue in mauris molestie pellentesque at convallis eros. Ut luctus ex eget tempor scelerisque. Praesent blandit velit eu turpis aliquam pellentesque. Cras vel erat eget ligula sollicitudin commodo.Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non fringilla risus. Quisque sollicitudin iaculis nunc, ultricies fringilla ex malesuada eu. Quisque a augue in mauris molestie pellentesque at</p>
<p style="text-indent: 50px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non fringilla risus. Quisque sollicitudin iaculis nunc, ultricies fringilla ex malesuada eu. Quisque a augue in mauris molestie pellentesque at convallis eros. Ut luctus ex eget tempor scelerisque.</p>
</section>
<aside class="sidebar">
<div class="therapy">
<img src="http://www.w3newbie.com/wp-content/uploads/therapist.jpg" alt="need new" title="new">
</div><!--close therapy div-->
</aside>
<div class="section">
<h3>Text Text Text Text</h3>
<img src="http://www.w3newbie.com/wp-content/uploads/private.png" alt="need new" title="new">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non fringilla risus In non fringilla risus. Quisque sollicitudin iaculis nunc, ultricies fringilla ex malesuada eu. Quisque a augue in mauris molestie</p>
</div><!--close section div-->
<div class="section">
<h3>Text Text Text Text</h3>
<img src="http://www.w3newbie.com/wp-content/uploads/sauna-steam.png" alt="need new" title="new">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non fringilla risusIn non fringilla risus. Quisque sollicitudin iaculis nunc, ultricies fringilla ex malesuada eu. Quisque a augue in mauris molestie</p>
</div><!--close section div-->
<div class="section">
<h3>Text Text Text Text</h3>
<img src="http://www.w3newbie.com/wp-content/uploads/retreat.png" alt="need new" title="new">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In non fringilla risusIn non fringilla risus. Quisque sollicitudin iaculis nunc, ultricies fringilla ex malesuada eu. Quisque a augue in mauris molestie</p>
</div><!--close section div-->
<!--fix w h2 and css --><center><img src="http://www.w3newbie.com/wp-content/uploads/ease.png" alt="need new" title="new"></center>
<footer>
<div class="section">
<p>Text Text Text</p>
<p><strong>727-555-5555</strong><br>
123 Main St<br>
Anywhere, FL 33770<br>
blank#blahblah.com</p>
</div>
<div class="section">
<p>Connect with us!</p>
<ul>
<li><img src="http://www.w3newbie.com/wp-content/uploads/facebook1.png" alt="need new" title="new"></li>
<li><img src="http://www.w3newbie.com/wp-content/uploads/googleplus.png" alt="need new" title="new"></li>
<li><img src="http://www.w3newbie.com/wp-content/uploads/twitter1.png" alt="need new" title="new"></li>
<li><img src="http://www.w3newbie.com/wp-content/uploads/youtube1.png" alt="need new" title="new"></li>
</ul>
</div>
<div class="section">
<img src="http://www.w3newbie.com/wp-content/uploads/plant.png" alt="need new" title="new">
</div>
</footer>
</div><!--end wrapper div-->
<p>© 2014.</p><!--margin 0 auto this-->
</body>
</html>
I know it is a lot, but I am stuck, I think my math is off. Please advise me how I can resolve and thank you.
I found a typo (an unecessary colon):
.sidebar: { /*here*/
width: 40%;
float: right;
margin: 1%;
text-align: center;
}
If you want to improve the use of white space, you need to make a concept at first. For example your text is currently above a huge image. Unter this huge image there are three smaller boxes.
So you could say in full screen you want the image and text next to each other. This is done by adding the following to the media query you want the text and image to appear next to each other:
aside.sidebar {
width: 40%;
float: right;
margin-right: 2%;
margin-top: 30px;
}
Then you need to insert
<div style="clear: both;"></div>
Below the closing </aside> tag! You have inserted something like this for your sidebar in line 106 with .sidebar:, which is a "broken code" because of the : after your css class.
This is a quite simple example, but works for all kinds of pages. If you need further explanations feel free to ask, this is a "quick help" copy & paste solution.
Best regards,
Marian.

How can I remove/cover up a section of a border?

How can I remove/cover up the 14px of border to the right of main_right_article_pic.png?
HTML:
<div class="main_right_article">
<span class="main_right_article_left">
<img src="img/main_right_article_pic.png" width="54" height="54" alt="Joe Bloggs">
</span>
<article>
<h4>Joe Bloggs</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mollis fringilla mi quis sollicitudin. Maecenas orci diam, congue eget sodales nec, facilisis eu eros.</p>
</article>
</div>
CSS:
*
{
margin: 0;
padding: 0;
}
body
{
font-family: 'Open Sans', sans-serif;
}
div.main_right_article
{
clear: both;
float: left;
margin-top: 25px;
width: 425px;
}
span.main_right_article_left
{
float: left;
background: url("../img/article_mark.png") no-repeat right 20px;
height: 54px;
width: 73px;
}
article
{
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
background-color: #f1f1f1;
border: 1px solid #c9c9ca;
float: right;
padding: 10px;
width: 330px;
}
article h4
{
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
text-shadow: 1px 1px 1px rgba(21, 21, 21, 0.3);
}
article p
{
font-size: 12px;
}
You can avoid this issue with a tooltip in CSS.
See: http://csstooltip.com
This is how I did it:
CSS:
span.main_right_article_left
{
float: left;
height: 54px;
width: 54px;
}
span.main_right_article_mark
{
background-image: url("../img/article_mark.png");
float: left;
height: 14px;
position: relative;
right: -6px;
top: 20px;
width: 14px;
}
HTML:
<div class="main_right_article">
<span class="main_right_article_left std_pic">
<img src="img/main_right_article_pic.png" width="54" height="54" alt="Joe Bloggs">
</span>
<span class="main_right_article_mark"> </span>
<article>
<h4>Joe Bloggs</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mollis fringilla mi quis sollicitudin. Maecenas orci diam, congue eget sodales nec, facilisis eu eros.</p>
</article>
</div>