I am trying to design the vertical bootstrap header panel, and I have almost achieved it using this
.panel
{
position: relative;
}
.panel-default > .panel-leftheading
{
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-primary > .panel-leftheading
{
color: #fff;
background-color: #428bca;
border-color: #428bca;
}
.panel-success > .panel-leftheading
{
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.panel-info > .panel-leftheading
{
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.panel-warning > .panel-leftheading
{
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.panel-danger > .panel-leftheading
{
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.panel-leftheading
{
width: 42px;
padding: 10px 15px;
border-right: 1px solid transparent;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
float: left;
height: 100%;
position: absolute;
}
.panel-lefttitle
{
margin-top: 0;
margin-bottom: 0;
margin-left: 15px;
font-size: 16px;
color: inherit;
-webkit-transform: rotate(90deg);
-webkit-transform-origin: left top;
-moz-transform: rotate(90deg);
-moz-transform-origin: left top;
-ms-transform: rotate(90deg);
-ms-transform-origin: left top;
-o-transform: rotate(90deg);
-o-transform-origin: left top;
transform: rotate(90deg);
transform-origin: left top;
position: absolute;
white-space: nowrap;
}
.panel-rightbody
{
float: left;
margin-left: 45px;
padding: 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="page-header">
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-leftheading">
<h3 class="panel-lefttitle">Panel title</h3>
</div>
<div class="panel-rightbody">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
Now the header is set to the vertical but the font alignment is not as expected. the font on the header should be readable and must be horizontal like this image
what css I need to change?
You can remove the transforms and the margin-left and add a width (set as 0 here) smaller than the font-size(16px here) to the get the effect:
.panel-lefttitle {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
white-space: pre-wrap;
word-wrap: break-word;
text-align: center;
width: 0;
}
Also note have added in word-wrap: break-word and white-space: pre-wrap for the text to flow vertically preserving whitespaces / line-breaks.
.panel {
position: relative;
}
.panel-default > .panel-leftheading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-primary > .panel-leftheading {
color: #fff;
background-color: #428bca;
border-color: #428bca;
}
.panel-success > .panel-leftheading {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.panel-info > .panel-leftheading {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.panel-warning > .panel-leftheading {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.panel-danger > .panel-leftheading {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.panel-leftheading {
width: 42px;
padding: 10px 15px;
border-right: 1px solid transparent;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
float: left;
height: 100%;
position: absolute;
}
.panel-lefttitle {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
white-space: pre-wrap;
word-wrap: break-word;
text-align: center;
width: 0;
}
.panel-rightbody {
float: left;
margin-left: 45px;
padding: 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="page-header">
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-leftheading">
<h3 class="panel-lefttitle">Panel title</h3>
</div>
<div class="panel-rightbody">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
Let me know your feedback on this. Thanks!
You could use manual styling through <br> elements but this would be annoying.
You could wrap every letter into its own <span> element. This would be more comfortable, but still way too static.
Use css. To be more precise, use word-wrap. To do so, you've to adjust your .panel-lefttitle styling like so:
.panel-lefttitle {
width: 0;
word-break: break-word;
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
position: absolute;
}
You've to set width:0 so every letter gets displayed in a separate line. Live Demo
I have changed the width and the margin of your h3, deleted the transform and changed white-space.
If you want to change the alignment of letters, you can change the text-align.
Here is the solution for your need:
.panel {
position: relative;
}
.panel-default > .panel-leftheading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-primary > .panel-leftheading {
color: #fff;
background-color: #428bca;
border-color: #428bca;
}
.panel-success > .panel-leftheading {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.panel-info > .panel-leftheading {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.panel-warning > .panel-leftheading {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.panel-danger > .panel-leftheading {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.panel-leftheading {
width: 42px;
padding: 10px 15px;
border-right: 1px solid transparent;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
float: left;
height: 100%;
position: absolute;
}
.panel-lefttitle {
margin-top: 0;
margin-bottom: 0;
margin-left: 0px;
font-size: 16px;
color: inherit;
position: absolute;
white-space: pre-wrap;
word-wrap: break-word;
width: 7px;
line-height: 16px;
text-align: left;
}
.panel-rightbody {
float: left;
margin-left: 45px;
padding: 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="page-header">
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-leftheading">
<h3 class="panel-lefttitle">Panel title</h3>
</div>
<div class="panel-rightbody">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
This might be helpful. I converted each letter into a span-element and rotated each one. It is not quite beautiful, but demonstrates how this could be solved.
I only added some JavaScript to achieve your desired behavior.
This code comes (partly) from Matt Whipple's answer in this post.
$(function() {
$(".panel-lefttitle").html(("<span>" + $(".panel-lefttitle").html().split("").join("</span><span>") + "</span>"));
$(".panel-lefttitle span").each(function() {
$(this).css({
"-webkit-transform": "rotate(-90deg)",
"display": "inline-block",
"letter-spacing": "1em"
});
});
});
.panel
{
position: relative;
}
.panel-default > .panel-leftheading
{
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-primary > .panel-leftheading
{
color: #fff;
background-color: #428bca;
border-color: #428bca;
}
.panel-success > .panel-leftheading
{
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.panel-info > .panel-leftheading
{
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.panel-warning > .panel-leftheading
{
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.panel-danger > .panel-leftheading
{
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.panel-leftheading
{
width: 42px;
padding: 10px 15px;
border-right: 1px solid transparent;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
float: left;
height: 100%;
position: absolute;
}
.panel-lefttitle
{
margin-top: 0;
margin-bottom: 0;
margin-left: 15px;
font-size: 16px;
color: inherit;
-webkit-transform: rotate(90deg);
-webkit-transform-origin: left top;
-moz-transform: rotate(90deg);
-moz-transform-origin: left top;
-ms-transform: rotate(90deg);
-ms-transform-origin: left top;
-o-transform: rotate(90deg);
-o-transform-origin: left top;
transform: rotate(90deg);
transform-origin: left top;
position: absolute;
white-space: nowrap;
}
.panel-rightbody
{
float: left;
margin-left: 45px;
padding: 15px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="page-header">
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-leftheading">
<h3 class="panel-lefttitle">Panel title</h3>
</div>
<div class="panel-rightbody">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
Related
Here is the code i used. On pressing the navbar menu the content should move right with a delay of 0.7s same as the sidebar opens with a delay of 0.7s but it is not working.
Kindly review the code and suggest something.
is it because of some media query I am using or anything else.?
Kindly review the code and suggest something.
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
}
.header{
width: 100%;
height: 70px;
background-color: #2f3640;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
}
.header img{
width: 60px;
height: 60px;
margin-right: 15px;
}
.header h1 {
line-height: 70px;
color: #fff;
}
.Content{
margin-top: 80px;
width: 100;
padding: 20px;
float: right;
transition: all 0.7s;
}
.Content img{
width: 100%;
max-width: 700px;
display: block;
margin: auto;
}
.Content p{
text-align: justify;
}
.Sidebar{
width: 20%;
height: 100%;
position: fixed;
top: 70px;
background-color: #353b48;
left: -100%;
transition: .7s;
}
.Sidebar ul{
list-style: none;
}
.Sidebar ul li {
border-bottom: 2px solid rgba(255, 255, 255, .1);
}
.Sidebar ul li a{
display: block;
text-decoration none;
color: #fff;
font-size: 20px;
padding: 15px 25px;
transition: .4s;
}
span{
margin-left: 15px;
}
.Sidebar ul li a:hover {
border-left: 10px solid white;
}
.social{
margin-top: 200px;
display: flex;
justify-content: space-evenly;
align-items: center;
font-size: 30px;
border-bottom: 2px solid rgba(255, 255, 255, .1);
border-top: 2px solid rgba(255, 255, 255, .1);
padding: 15px 25px;
}
i{
font-size: 30px;
color: #fff;
transition: .2s;
}
i:hover{
transform: scale(1.2);
color: green;
}
.show-btn, .hide-btn {
font-size: 35px;
color: #fff;
position: fixed;
top: 15px;
left: 50px;
}
#chk{
position: absolute;
visibility: hidden;
z-index: -10;
}
.hide-btn{
opacity: 0;
}
#chk:checked ~ .Sidebar{
left: 0;
}
#chk:checked ~ .show-btn{
opacity: 0;
}
#chk:checked ~ .hide-btn{
opacity: 1;
}
#chk:checked ~ .Content{
width: 80%;
float: right;
transition: all 0.7s;
}
#media(max-width: 768px){
.Sidebar{
width: 100%;
text-align: center;
}
.Sidebar ul li a:hover {
border-left: 30px solid white;
}
.header h1{
display: none;
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Side-NavBar</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<div class="header">
<img src="../images/fullstackLogo.png" alt="logo-img">
<h1>FullStack</h1>
</div>
<input type="checkbox" name="" id="chk">
<label for="chk" class="show-btn">
<i class="fa fa-bars"></i>
</label>
<label for="chk" class="hide-btn">
<i class="fa fa-times"></i>
</label>
<div class="Sidebar">
<ul>
<li><i class="fa fa-home"><span>Home</span></i></li>
<li><i class="fa fa-user"><span>About</span></i></li>
<li><i class="fa fa-tasks"><span>Services</span></i></li>
<li><i class="fa fa-rss"><span>Blog</span></i></li>
<li><i class="fa fa-id-card"><span>Contact</span></i></li>
</ul>
<div class="social">
<i class="fa fa-facebook-square"></i>
<i class="fa fa-youtube-square"></i>
<i class="fa fa-instagram"></i>
</div>
</div>
<div class="Content">
<img src="../images/laptop1.jpg" alt="body-img">
<p>
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</body>
</html>
I corrected your code.
This CSS transitions is not working perfectly Because of you are using different CSS property of sidebar and content part to show this transitions.
Currently you are manipulating CSS property of sidebar is left -100% to 0 cause this issue.
Please manage CSS properties width:0% to 20% of sidebar which transact over a same period of time as content part.
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
}
.header {
width: 100%;
height: 70px;
background-color: #2f3640;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
}
.header img {
width: 60px;
height: 60px;
margin-right: 15px;
}
.header h1 {
line-height: 70px;
color: #fff;
}
.Content {
margin-top: 80px;
width: 100%;
padding: 20px;
float: right;
transition: all 0.7s;
}
.Content img {
width: 100%;
max-width: 700px;
display: block;
margin: auto;
}
.Content p {
text-align: justify;
}
.Sidebar {
width:0%;
height: 100%;
position: fixed;
top: 70px;
background-color: #353b48;
left:0;
transition: all 0.7s;
overflow: hidden;
}
.Sidebar ul {
list-style: none;
}
.Sidebar ul li {
border-bottom: 2px solid rgba(255, 255, 255, .1);
}
.Sidebar ul li a {
display: block;
text-decoration none;
color: #fff;
font-size: 20px;
padding: 15px 25px;
transition: .4s;
}
span {
margin-left: 15px;
}
.Sidebar ul li a:hover {
border-left: 10px solid white;
}
.social {
margin-top: 200px;
display: flex;
justify-content: space-evenly;
align-items: center;
font-size: 30px;
border-bottom: 2px solid rgba(255, 255, 255, .1);
border-top: 2px solid rgba(255, 255, 255, .1);
padding: 15px 25px;
}
i {
font-size: 30px;
color: #fff;
transition: .2s;
}
i:hover {
transform: scale(1.2);
color: green;
}
.show-btn, .hide-btn {
font-size: 35px;
color: #fff;
position: fixed;
top: 15px;
left: 50px;
}
#chk {
position: absolute;
visibility: hidden;
z-index: -10;
}
.hide-btn {
opacity: 0;
}
#chk:checked ~ .Sidebar {
width: 20%;
}
#chk:checked ~ .show-btn {
opacity: 0;
}
#chk:checked ~ .hide-btn {
opacity: 1;
}
#chk:checked ~ .Content {
width: 80%;
}
#media(max-width: 768px) {
.Sidebar {
width: 100%;
text-align: center;
}
.Sidebar ul li a:hover {
border-left: 30px solid white;
}
.header h1 {
display: none;
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Side-NavBar</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<div class="header"> <img src="../images/fullstackLogo.png" alt="logo-img">
<h1>FullStack</h1>
</div>
<input type="checkbox" name="" id="chk">
<label for="chk" class="show-btn"> <i class="fa fa-bars"></i> </label>
<label for="chk" class="hide-btn"> <i class="fa fa-times"></i> </label>
<div class="Sidebar">
<ul>
<li><i class="fa fa-home"><span>Home</span></i>
<About/li>
<li><i class="fa fa-user"><span>About</span></i></li>
<li><i class="fa fa-tasks"><span>Services</span></i></li>
<li><i class="fa fa-rss"><span>Blog</span></i></li>
<li><i class="fa fa-id-card"><span>Contact</span></i></li>
</ul>
<div class="social"> <i class="fa fa-facebook-square"></i> <i class="fa fa-youtube-square"></i> <i class="fa fa-instagram"></i> </div>
</div>
<div class="Content"> <img src="../images/laptop1.jpg" alt="body-img">
<p> Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiHomesicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum. </p>
</div>
</body>
</html>
Please click on 'full page' to see correct output
I'm sure this is relatively simple problem but after some fiddling I'm not finding much luck, will fix one thing then another problem arises. As you can see below (this is on desktop, mobile works perfect) the text boxes are way too big, leaving loads of white space below texts, some images are a good size, some are too big, the top one looks the best. The idea being the image spans across one side then the text box is the same height next to it.
Here is a picture of the mobile for reference
I wont link all the HTML and CSS, just the relevant stuff. Any advice is welcome and appreciated.
<html lang="en" dir="ltr">
<head>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght#300;400;600&family=Poppins:wght#300;400;500;700&display=swap" rel="stylesheet">
<meta charset="utf-8" >
<meta name="description" content="Jordan Squres, mixed martial arts trainer, working out of Oxfordshire">
<meta name="keywords" content="MMA, martial arts, personal trainer, self defence, exercise">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="autor" content="Descisive Development">
<link rel="stylesheet" href="styles.css">
<title>Jordan Squires, Home</title>
</head>
<body >
<nav class="navbar">
Jordan Squires
<input class="menu-btn" type="checkbox" id="menu-btn" />
<label class="menu-icon" for="menu-btn"><span class="nav-icon"></span></label>
<ul class="menu">
<li class="navitem"> Home</li>
<li class="navitem"> About</li>
<li class="navitem"> Clients</li>
<li class="navitem"> Blog</li>
<li class="navitem"> Contact</li>
</ul>
</div>
</nav>
<section class="home-hero">
<div class="flex-container">
<div class="img-hero">
<img src="images/portfolio1.jpg" alt="">
</div>
<div class="info-hero">
<h1>Jordan</h1>
<h2>MMA Instructor</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<div class="flex-container" id="even">
<div class="img-hero">
<img src="images/portfolio2.jpg" alt="">
</div>
<div class="info-hero">
<h1>Shotokan Karate</h1>
<h2>Black Belt</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<div class="flex-container">
<div class="img-hero">
<img src="images/portfolio3.jpg" alt="">
</div>
<div class="info-hero">
<h1>Jeet Kune Do</h1>
<h2>Black Belt</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="flex-container"id="even">
<div class="img-hero">
<img src="images/portfolio4.jpg" alt="">
</div>
<div class="info-hero">
<h1>Brazilian Jiu Jitsu</h1>
<h2>Purple Belt</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="flex-container">
<div class="img-hero">
<img src="images/portfolio5.jpg" alt="">
</div>
<div class="info-hero">
<h1>Jordan</h1>
<h2>MMA Instructor</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</section>
</body>
</html>
and the css
box-sizing: inherit;
margin: 0 auto;
padding: 0;
}
html{
font-size: 10px;
max-width: 1300px;
box-sizing: border-box;
}
body{
background: var(--white);
}
a{
color: var(--main-txt);
text-decoration: none;
}
:root{
--white: #F1FAEE;
--outline-color: #000000;
--bg-color: #1D3557;
--main-txt: #457B9D;
--alt-txt: #A8DADC;
--red: #E63946;
--ff: 'Montserrat', sans-serif;
--ff2: 'Poppins', sans-serif;
--fw-l: 300;
--fw-n: 400;
--fw-m: 600;
--fw-b: 700;
--fs-1: ;
--fs-2: ;
--fs-3: ;
--fs-p: ;
--shadow: 0px 7px 10px 0px rgba(0,0,0,.3);
}
/*global style container*/
.container{
max-width: 1360px;
}
/*Navbar styles*/
.navbar{
box-shadow: 0px 3px 3px -3px rgb(0, 0, 0);
width: 100%;
font-size: 1.8rem;
font-family: var(--ff2);
}
.navbar ul{
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
}
.navbar ul a{
display: block;
padding: 2rem;
text-align: center;
text-transform: uppercase;
font-weight: var(--fw-n)
}
.navbar ul a:hover{
background-color: var(--bg-color);
color: var(--white);
}
.navbar .logo{
float: left;
display: block;
font-size: 2rem;
padding: 1.5rem;
text-decoration: underline;
text-decoration-thickness: 0.2rem;
text-underline-offset: 0.5rem;
}
.navbar .menu{
clear: both;
max-height: 0;
transition: max-height .2s ease-out;
}
.navbar .menu-icon{
padding: 2.8rem 2rem;
position: relative;
float: right;
cursor: pointer;
}
.navbar .menu-icon .nav-icon{
background: var(--bg-color);
display: block;
height: .2rem;
width: 1.8rem;
position: relative;
transition: background .2s ease-out;
}
.navbar .menu-icon .nav-icon:before{
background: var(--bg-color);
content: "";
display: block;
height: 100%;
width: 100%;
position: absolute;
transition: all .2s ease-out;
top: .5rem;
}
.navbar .menu-icon .nav-icon:after{
background: var(--bg-color);
content: "";
display: block;
height: 100%;
width: 100%;
position: absolute;
transition: all .2s ease-out;
top: -.5rem;
}
.navbar .menu-btn{
display: none;
}
.navbar .menu-btn:checked ~ .menu{
max-height: 36rem;
}
.navbar .menu-btn:checked ~ .menu-icon .nav-icon{
background: transparent;
}
.navbar .menu-btn:checked ~ .menu-icon .nav-icon:before{
transform: rotate(-45deg);
top: 0;
}
.navbar .menu-btn:checked ~ .menu-icon .nav-icon:after{
transform: rotate(45deg);
top: 0;
}
/*Homepage main section*/
.home-hero{
margin: 1rem auto;
}
.flex-container{
width: 100%;
height: auto;
display: flex;
flex-wrap: wrap;
}
.img-hero{
width: 90%;
margin-top: 2rem;
margin-bottom: 2rem;
padding-bottom: -3px;
}
.info-hero{
width: 90%;
font-family: var(--ff);
border: 1px solid var(--outline-color);
padding: 3rem;
background-color: var(--bg-color);
}
/*Image styles*/
.img-hero img{
max-width: 100%;
object-fit: contain;
max-height: 100%;
margin-bottom: -3px;
border: 1px solid var(--outline-color);
}
/*Info styles*/
.info-hero h1{
font-size: 3rem;
color: var(--white);
}
.info-hero h2{
font-size: 2rem;
font-style: italic;
color: var(--red);
}
.info-hero h1 h2{
font-family: var(--ff2);
}
.info-hero p{
font-size: 1.2rem;
text-align: justify;
color: var(--alt-txt);
}
/*Media for Navbar*/
#media (min-width: 760px) {
.navbar{
height: 6.7rem;
}
.navbar li{
float: left;
}
.navbar li a{
padding: 2rem 2.5rem;
}
.navbar .menu{
clear: none;
float: right;
max-height: none;
}
.navbar .menu-icon{
display: none;
}
.navbar .logo{
padding: 2rem;
}
.flex-container{
flex-direction: row;
margin: 2rem auto;
}
.img-hero{
width: 50%;
margin: inherit;
}
.info-hero{
width: 45%;
padding: 2rem;
}
#even{
flex-direction: row-reverse;
}
}
Here is a simple example I just wrote for you, you may adjust it according to your needs.
.flex-container {
display: flex;
margin-bottom: 1rem;
}
.img-hero, .info-hero {
max-width: 50%;
}
.img-hero img {
width: 100%;
height: 100%;
object-fit: cover;
}
.info-hero {
background: violet;
color: white;
}
.info-hero > * {
padding: 0.5rem 1rem;
}
<div class="flex-container">
<div class="img-hero">
<img src="https://picsum.photos/900/700" alt="">
</div>
<div class="info-hero">
<h1>Jordan</h1>
<h2>MMA Instructor</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
<div class="flex-container">
<div class="info-hero">
<h1>Jordan</h1>
<h2>MMA Instructor</h2>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br>
<br>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="img-hero">
<img src="https://picsum.photos/800/600" alt="">
</div>
</div>
When I hover on my button my H2 and paragraph wiggle. How can I prevent it? As you can see I would like to add more border during hovering. Is it a cause this situation?
.about-me-wrapper {
background-color: #fff;
width: 50%;
margin: 10em auto;
height: 50%;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.about-me-wrapper p {
width: 70%;
line-height: 1.75;
}
.about-me-wrapper a {
background: transparent;
border: 2px solid #000;
padding: 10px 20px;
margin: 20px 0;
font-weight: 700;
text-transform: uppercase;
transition: all .4s;
display: inline-block;
}
.about-me-wrapper a:hover {
cursor: pointer;
border: 3px solid #4EADFF;
color: #4EADFF;
transform: scale(1.1);
}
<section class="about-me">
<div class="about-me-wrapper">
<h2>Aarhus Lejerboliger</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
View project
</div>
</section>
I am stuck here, i want to make fix nav with full height section with content but second section is not going good after scroll, need help.
Below my tried code:
*,
*::after,
*::before {
margin: 0px;
padding: 0px;
box-sizing: inherit;
-webkit-box-sizing: inherit;
}
body,
html {
margin: 0px;
padding: 0px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
nav {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
text-align: center;
padding: 10px 0px;
background: tomato;
}
nav ul {
margin: 0px;
padding: 0px;
list-style: none;
text-align: center;
}
nav ul li {
display: inline-block;
margin: 3px;
}
nav ul li a {
display: block;
padding: 5px;
background: #000;
color: #ddd;
text-decoration: none;
}
nav ul li a:hover {
background: #ddd;
color: #333;
}
section {
height: 100vh;
background: #303030;
margin: 0px;
padding: 0px;
}
section p {
margin-top: 54px;
color: #fff;
}
section.green {
background: green;
height: 100vh;
margin: 0px;
padding: 0px;
}
section.green p {
color: #ddd;
}
<section>
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Service</li>
<li>Contact</li>
</ul>
</nav>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
<section class="green">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
</section>
Can anyone help me out and provide me a solution to my problem?
You have nested <section> which is not recommended, a better approach should replace your outer <section> with <div class="wrapper">...</div>
Then use a wrapper class to set the margin-top: 54px which is the height of nav.
.wrapper {
margin-top: 54px;
height: 100vh;
background: #303030;
padding: 0px;
}
For the overlap, use calc to set the height dynamically height: calc(100vh - 52px);
*,
*::after,
*::before {
margin: 0px;
padding: 0px;
box-sizing: inherit;
-webkit-box-sizing: inherit;
}
body,
html {
margin: 0px;
padding: 0px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
nav {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
text-align: center;
padding: 10px 0px;
background: tomato;
}
nav ul {
margin: 0px;
padding: 0px;
list-style: none;
text-align: center;
}
nav ul li {
display: inline-block;
margin: 3px;
}
nav ul li a {
display: block;
padding: 5px;
background: #000;
color: #ddd;
text-decoration: none;
}
nav ul li a:hover {
background: #ddd;
color: #333;
}
section {
height: 100vh;
background: #303030;
margin: 0px;
padding: 0px;
}
.wrapper {
margin-top: 54px;
height: 100vh;
background: #303030;
padding: 0px;
}
section p {
color: #fff;
}
section.green {
background: green;
height: calc(100vh - 52px);
margin: 0px;
padding: 0px;
}
section.green p {
color: #ddd;
}
<div class="wrapper">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Service</li>
<li>Contact</li>
</ul>
</nav>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
<section class="green">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
</div>
You can use calc() to calculate the height of the sections
height: calc(100vh - 54px); /*54px is the height of the nav*/
So this will make the height of each section have the height of the screen minus the height of the nav.
And to remove the space between the sections you need to remove margin-top from the p tag and add padding-top:54px;to the container, again 54px is the height of the nav, and that for the sections to start right after the nav
*,
*::after,
*::before {
margin: 0px;
padding: 0px;
box-sizing: inherit;
-webkit-box-sizing: inherit;
}
body,
html {
margin: 0px;
padding: 0px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.container {
height: 100vh;
padding-top:54px;
}
nav {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
text-align: center;
padding: 10px 0px;
background: tomato;
}
nav ul {
margin: 0px;
padding: 0px;
list-style: none;
text-align: center;
}
nav ul li {
display: inline-block;
margin: 3px;
}
nav ul li a {
display: block;
padding: 5px;
background: #000;
color: #ddd;
text-decoration: none;
}
nav ul li a:hover {
background: #ddd;
color: #333;
}
section {
height: calc(100vh - 54px);
background: #303030;
margin: 0px;
padding: 0px;
}
section p {
color: #fff;
}
section.green {
background: green;
margin: 0px;
padding: 0px;
}
section.green p {
color: #ddd;
}
<div class="container">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Service</li>
<li>Contact</li>
</ul>
</nav>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
<section class="green">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</section>
</div>
When I add .article img { float:right; } the image goes out of the div article and i am not getting the desired result I want. I want to align the image within grey box and to the right.
Here it is what I achieve.
What I am getting is the image is aligned outside the main container.
{
margin: 0;
padding: 0;
}
body{
width: 960px;
margin: 0 auto;
}
html {
background: url(bgimage.jpg) no-repeat center center fixed;
-webkit-background-size:cover;
background-size: cover;
}
.content-container{
background: rgba(255,255,255,.48);
margin-top: 50px;
border: 2px #e5e5e5 solid;
border-radius: 7px ;
box-shadow: 2px 2px 6px black;
}
.main-container{
margin: 10px;
padding: 5px;
}
.articles{
background: rgba(182,182,168,0.7);
border: 2px solid black;
border-radius: 5px;
}
.articles h3{
padding-left: 15px;
padding-top: 1px;
margin-bottom: 2px;
}
.articles p{
margin-top: 1px;
padding-bottom: 10px;
padding-left: 15px;
padding-right: 15px;
width: 920px;
}
.articles img{
float: right;
}
<div class="content-container">
<div class="main-container">
<div class="articles">
<h3>Heading of the article</h3>
<br/>
<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
<img src="http://placekitten.com/g/300/300"></img>
</div>
</div>
</div>
This can be easily solved by adding a clear element at the end:
<div class="clear"></div>
the css:
.clear {
clear: both;
}
example:
.clear {
clear: both;
}
body{
width: 960px;
margin: 0 auto;
}
html {
background: url(bgimage.jpg) no-repeat center center fixed;
-webkit-background-size:cover;
background-size: cover;
}
.content-container{
background: rgba(255,255,255,.48);
margin-top: 50px;
border: 2px #e5e5e5 solid;
border-radius: 7px ;
box-shadow: 2px 2px 6px black;
}
.main-container{
margin: 10px;
padding: 5px;
}
.articles{
background: rgba(182,182,168,0.7);
border: 2px solid black;
border-radius: 5px;
}
.articles h3{
padding-left: 15px;
padding-top: 1px;
margin-bottom: 2px;
}
.articles p{
margin-top: 1px;
padding-bottom: 10px;
padding-left: 15px;
padding-right: 15px;
width: 920px;
}
.articles img{
float: right;
}
<div class="content-container">
<div class="main-container">
<div class="articles">
<h3>Heading of the article</h3>
<br/>
<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
<img src="http://placekitten.com/g/300/300">
<div class="clear"></div>
</div>
</div>
</div>