As you can see i goes straight to the middle instead of the starting point of the div. I have set a margin and width for my div and when I do input an <H1> tag, the text just floats to the middle of the div instead of the far left where the div begins. I have set the width so it can start at that starting point not 45px to the left.
This is the HTML
<div id="topbar">
<div id="logo"> <img src="Pictures/bbc.png"> </div>
<div id="signin" class="border-part"> </div>
<div> <img id="logo-image" src="Pictures/signin.png">
<p class="signin-text">Sign in</p>
</div>
<div id="dash"> <img id="dash-image" src="Pictures/bash2.png"> </div>
<div> <img id="bell"src="Pictures/bell3.png"> </div>
<div class="border-part stuff-section"> News </div>
<div class="border-part stuff-section"> Sport </div>
<div class="border-part stuff-section"> Weather </div>
<div class="border-part stuff-section"> iPlayer </div>
<div class="border-part stuff-section"> TV </div>
<div class="border-part stuff-section"> Radio </div>
<div class="border-part stuff-section"> More </div>
<div class="seacher-border">
<input id="search-box" type="text" placeholder="Search">
<img id="search-pic" src="Pictures/search.png"> </div>
</div>
<div id="second-bar">
<div id="newsbar">
<h1>NEWS</h1>
</div>
</div>
This is my CSS
#topbar {
width: 1080px;
margin: 0 auto;
height: 40px;
}
body {
margin: 0;
padding: 0;
font-family: Helmet, Freesans, Helvetica, Arial, sans-serif;
;
}
#logo {
margin-top: 8px;
float: left;
margin-right: 8px;
}
.border-part {
float: left;
height: 100%;
border-left: 1px #CCCCCC solid;
}
#logo-image {
width: 20px;
margin: 12px;
float: left;
}
.signin-text {
margin: 14px;
font-size: 90%;
font-weight: bold;
float: left;
}
#dash-image {
padding-left: 50px;
float: left;
height: 40px;
}
#bell {
margin: 8px;
height: 28px;
float: left;
}
.stuff-section {
font-weight: bold;
font-size: 90%;
padding: 13px 15px 0 15px;
height: 27px;
}
.seacher-border {
float: left;
height: 100%;
border-left: 1px #CCCCCC solid;
margin-left: 20px;
}
#search-box {
margin: 10px;
font-weight: bold;
background-color: #E4E4E4;
font-size: 14px;
border: none;
height: 24px;
float: left;
}
#search-pic {
position: relative;
right: 10px;
top: 10px;
height: 25px;
}
#second-bar {
background-color: #BB1919;
width: 100%;
height: 80px;
}
#newsbar {
width: 1080px;
margin: 0 auto;
background-color: blue;
}
h1 {
padding: 0;
margin: 0;
float;
}
A flexbox option for alignment
#second-bar {
display: flex;
background-color: #BB1919;
width: 100%;
height: 80px;
}
#newsbar {
display: flex;
justify-content: flex-start; /* horizontal alignment - change to flex-end or center to see difference */
align-items: center; /* vertical alignment */
width: 100%;
margin:0 auto;
}
h1 {
display: flex;
padding:0;
margin:0;
}
<div id="second-bar">
<div id="newsbar">
<h1>NEWS</h1>
</div>
</div>
fiddle
https://jsfiddle.net/Hastig/zn4qkok2/
A possible non-flexbox solution
#second-bar {
background-color: #BB1919;
width: 100%;
height: 80px;
}
#newsbar {
text-align: left; /* change to center or right to see difference */
vertical-align: middle;
width: 100%;
line-height: 80px; /* match to height of parent for centered vertical alignment */
margin:0 auto;
}
h1 {
display: inline-block;
padding:0;
margin:0;
}
<div id="second-bar">
<div id="newsbar">
<h1>NEWS</h1>
</div>
</div>
fiddle
https://jsfiddle.net/Hastig/zn4qkok2/1/
Just add clear: both to h1:
#topbar {
width: 1080px;
margin: 0 auto;
height: 40px;
}
body {
margin: 0;
padding: 0;
font-family: Helmet, Freesans, Helvetica, Arial, sans-serif;
;
}
#logo {
margin-top: 8px;
float: left;
margin-right: 8px;
}
.border-part {
float: left;
height: 100%;
border-left: 1px #CCCCCC solid;
}
#logo-image {
width: 20px;
margin: 12px;
float: left;
}
.signin-text {
margin: 14px;
font-size: 90%;
font-weight: bold;
float: left;
}
#dash-image {
padding-left: 50px;
float: left;
height: 40px;
}
#bell {
margin: 8px;
height: 28px;
float: left;
}
.stuff-section {
font-weight: bold;
font-size: 90%;
padding: 13px 15px 0 15px;
height: 27px;
}
.seacher-border {
float: left;
height: 100%;
border-left: 1px #CCCCCC solid;
margin-left: 20px;
}
#search-box {
margin: 10px;
font-weight: bold;
background-color: #E4E4E4;
font-size: 14px;
border: none;
height: 24px;
float: left;
}
#search-pic {
position: relative;
right: 10px;
top: 10px;
height: 25px;
}
#second-bar {
background-color: #BB1919;
width: 100%;
height: 80px;
}
#newsbar {
width: 1080px;
margin: 0 auto;
background-color: blue;
}
h1 {
padding: 0;
margin: 0;
clear: both;
}
<div id="topbar">
<div id="logo"> <img src="Pictures/bbc.png"> </div>
<div id="signin" class="border-part"> </div>
<div> <img id="logo-image" src="Pictures/signin.png">
<p class="signin-text">Sign in</p>
</div>
<div id="dash"> <img id="dash-image" src="Pictures/bash2.png"> </div>
<div> <img id="bell" src="Pictures/bell3.png"> </div>
<div class="border-part stuff-section"> News </div>
<div class="border-part stuff-section"> Sport </div>
<div class="border-part stuff-section"> Weather </div>
<div class="border-part stuff-section"> iPlayer </div>
<div class="border-part stuff-section"> TV </div>
<div class="border-part stuff-section"> Radio </div>
<div class="border-part stuff-section"> More </div>
<div class="seacher-border">
<input id="search-box" type="text" placeholder="Search">
<img id="search-pic" src="Pictures/search.png"> </div>
</div>
<div id="second-bar">
<div id="newsbar">
<h1>NEWS</h1>
</div>
</div>
Related
This question already has answers here:
Align inline-block DIVs to top of container element
(5 answers)
How to remove the space between inline/inline-block elements?
(41 answers)
Closed 8 months ago.
I have a panel with a bunch of items in list-like fashion. I want 3 different panels, but two on the left next to each other. I styled the panels the way I want, but when I copy-paste it to create another, it makes the div, but offsets it from the top.
Here's what I have right now:
html, body {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
color: #ededed;
font-family: Roboto;
}
.panel {
display: inline-block;
width: 15vw;
height: 100%;
border-right: 1px solid #272b3a;
background-color: #e0e0e0;
color: #000000;
margin: 0;
padding: 0;
padding-top: 20px;
padding-left: 15px;
position: relative;
margin-top: 0px;
}
.folder {
display: inline-flex;
align-items: center;
cursor: pointer;
margin: 0;
padding:0;
}
.folder-icon {
width: 30px;
}
.folder-name {
margin: 0;
margin-left: 6px;
top: 12px;
}
.add-folder {
cursor: pointer;
margin-left: -15px;
position: absolute;
bottom: 30px;
text-align: center;
width: calc(100% - 15px);
display:flex;
align-items: center;
justify-content: center;
}
.add-folder-text {
font-size: 15px;
margin: 0;
margin-bottom: 10px;
padding-left: 20%;
padding-right: 20%;
padding-top: 5%;
padding-bottom: 5%;
border-radius: 30px;
}
<div class="panel">
<div class="folder">
<p class="folder-name">Item 1</p>
</div>
<div class="folder">
<p class="folder-name">Item 2</p>
</div>
<div class="folder">
<p class="folder-name">Item 3</p>
</div>
<div class="folder">
<p class="folder-name">Item 4</p>
</div>
<div class="add-folder">
<p class="add-folder-text plus">Add folder</p>
</div>
</div>
<div class="panel">
<div class="folder">
<p class="folder-name">Social Networking</p>
</div>
<div class="add-folder">
<p class="add-folder-text plus">Add folder</p>
</div>
</div>
I added display: flex to the <body> CSS selector and is working.
because normally the body has a display: block by default. and flex put the element one near the other on the X-axis (and have other behaviors that solve this problem).
body {
display: flex; /*if you want you can use also "inline-flex" like you do for the other elements on your CSS file*/
}
html,
body {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
color: #ededed;
font-family: Roboto;
/* what I added */
display: flex;
}
.panel {
display: inline-block;
width: 15vw;
height: 100%;
border-right: 1px solid #272b3a;
background-color: #e0e0e0;
color: #000000;
margin: 0;
padding: 0;
padding-top: 20px;
padding-left: 15px;
position: relative;
margin-top: 0px;
}
.folder {
display: inline-flex;
align-items: center;
cursor: pointer;
margin: 0;
padding: 0;
}
.folder-icon {
width: 30px;
}
.folder-name {
margin: 0;
margin-left: 6px;
top: 12px;
}
.add-folder {
cursor: pointer;
margin-left: -15px;
position: absolute;
bottom: 30px;
text-align: center;
width: calc(100% - 15px);
display: flex;
align-items: center;
justify-content: center;
}
.add-folder-text {
font-size: 15px;
margin: 0;
margin-bottom: 10px;
padding-left: 20%;
padding-right: 20%;
padding-top: 5%;
padding-bottom: 5%;
border-radius: 30px;
}
<div class="panel">
<div class="folder">
<p class="folder-name">Item 1</p>
</div>
<div class="folder">
<p class="folder-name">Item 2</p>
</div>
<div class="folder">
<p class="folder-name">Item 3</p>
</div>
<div class="folder">
<p class="folder-name">Item 4</p>
</div>
<div class="add-folder">
<p class="add-folder-text plus">Add folder</p>
</div>
</div>
<div class="panel">
<div class="folder">
<p class="folder-name">Social Networking</p>
</div>
<div class="add-folder">
<p class="add-folder-text plus">Add folder</p>
</div>
</div>
I need to achieve a nice 2 column layout as shown in
So far i could get only: https://jsfiddle.net/8qskxqfh/
code in fiddle link
Could you please suggest me on improving this design.
.myRatingBoxRed {
display: inline-block;
width: 15px;
height: 15px;
background-color: red;
}
.myRatingBoxYellow {
display: inline-block;
width: 15px;
height: 15px;
background-color: yellow;
}
.myRatingBoxGreen {
display: inline-block;
width: 15px;
height: 15px;
background-color: green;
}
.myResourceViewBody {
width: 960px;
position: relative;
margin: 0 auto;
}
.myResourceViewBody.myResourceSideBar {
position: absolute;
left: 0;
width: 240px;
height: 100%;
min-height: 800px;
color: #fff;
}
.myResourceViewInfo {
background: #fff;
padding-left: 300px;
}
.myResourceViewInfo .section-title {
text-transform: uppercase;
font-size: 20px;
font-weight: 500;
color: #2d7788;
position: relative;
margin-top: 0;
margin-bottom: 20px;
}
.myResourceViewInfo .attributes-section .item {
margin-bottom: 15px;
}
.h2.myResourceTitle {
font-weight: bold;
background: #9A3324 none repeat scroll 0px 0px;
width: 66%;
padding-left: 5px;
color: #FFF;
font-size: 18px;
vertical-align: middle;
display: inline-block;
position: relative;
height: 50px;
padding-top: inherit;
margin-top: 4px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.myResourceViewBody ul {
font-size: 1.2em;
font-weight: bold;
list-style-type: none;
margin-left: 300px;
padding: 0 0 0 10px;
}
<div id="myResourceHeader">
<h2 class="header-title myResourceTitle">Test article 1</h2>
</div>
<div class="myResourceViewBody">
<div class="myResourceSideBar">
<div class="myImageBox"></div>
<div class="myEvaluationArea">
<div class="myRatingBoxRed"></div>
<div class="myRatingBoxYellow"></div>
<div class="myRatingBoxGreen"></div>
</div>
</div>
<div class="myResourceViewInfo">
<h2 class="myViewInfo section-title"><i class="fa icon-info-sign"></i>Description</h2>
<ul>
<li>demo 1</li>
<li>demo 2</li>
</ul>
</div>
</div>
<div class="myResourceViewFooter"></div>
Check example below:
.row {
display: table;
width: 100%;
}
.row:after {
clear: both;
}
.col {
display: table-cell;
border: 1px solid red;
}
.width-70 {
width: 70%;
}
.width-30 {
width: 30%;
}
<div class="row">
<div class="col width-30">
col1
</div>
<div class="col width-70">
col2
</div>
</div>
Try using col-spans inside row
something like this
<div class="row">
<div class="col-md-6">
//first column
</div>
<div class="col-md-6">
// second column
</div>
</div>
refer to bootstrap classes for more details and how to make it responsive also.
I have a navbar with a few elements inside it and a button that escapes the navbar when i resize it. What CSS property should I style to keep the button in CSS to stop the button from escaping the navbar?
Attached is a JFiddle of an example of what happens:
https://jsfiddle.net/6Lx0hkfa/
.green-button {
font-size: 13px;
display: inline-block;
height: 50px;
width: 170px;
float: left;
margin-left: 235px;
padding: 6px 10px;
background-color: rgb(185, 233, 137);
color: rgb(43, 150, 190);
text-transform: uppercase;
border-radius: 0px;
border-width: 0px;
border-style: initial;
border-color: initial;
box-sizing: border-box;
}
<section id="header">
<div class="wrapper">
<div class="address">7542 Fay Ave Upstairs Suite, La Jolla, CA 92037</div>
<div class="phone">(858) 381-0740</div>
<div class="email">sdacneclinic#gmail.com</div>
<div class="social">
<a class="social-btn fb" href="http://facebook.com"></a>
</div>
<div class="social">
<a class="social-btn tw" href="http://twitter.com"></a>
</div>
<div class="social">
<a class="social-btn ig" href="http://instagram.com"></a>
</div>
<div class="social">
<a class="social-btn gp" href="https://plus.google.com"></a>
</div>
<a href="/contacts">
<button class="green-button">Book Consultation</button>
</a>
</div>
</section>
I don't know what you are trying to achieve, but this one worked for me:
.green-button {
position: absolute;
}
This is a case where I would use float for simplicity. Note that this requires to put the link element on top of the rest of the wrapper's contents within the markup, but it's the most direct solution.
.green-button-link {
float: left;
}
.green-button {
font-size: 13px;
display: inline-block;
height: 50px;
width: 170px;
margin-right: 20px;
padding: 6px 10px;
background-color: rgb(185, 233, 137);
color: rgb(43, 150, 190);
text-transform: uppercase;
border-radius: 0px;
border-width: 0px;
border-style: initial;
border-color: initial;
box-sizing: border-box;
}
<section id="header">
<div class="wrapper">
<a class="green-button-link" href="/contacts">
<button class="green-button">Book Consultation</button>
</a>
<div class="address">7542 Fay Ave Upstairs Suite, La Jolla, CA 92037</div>
<div class="phone">(858) 381-0740</div>
<div class="email">sdacneclinic#gmail.com</div>
<div class="social">
<a class="social-btn fb" href="http://facebook.com"></a>
</div>
<div class="social">
<a class="social-btn tw" href="http://twitter.com"></a>
</div>
<div class="social">
<a class="social-btn ig" href="http://instagram.com"></a>
</div>
<div class="social">
<a class="social-btn gp" href="https://plus.google.com"></a>
</div>
</div>
</section>
check the snippet if its what you want.i added description add to ones I added to your code.
* {
margin: 0;
padding: 0;
}
body {
background: url(img/hero_bg.jpg) repeat-y center center fixed;
background size: 100%;
}
#header {
background-color: #1d7cb6;
display: block;
/* position: relative; */
color: white;
width: 100%;
height: 50px;
}
.wrapper {
text-align: center;
margin: 0px auto;
font-family: 'Raleway';
background: white;
z-index: 500;
vertical-align: middle;/* add */
position: relative;/* add */
padding-right: 200px;
}
.address {
display: inline-block;
width: 240px;
float: left;
display: inline-block;
height: 100%;
font-size: 10px;
padding: 20px 18px;
}
.phone {
display: inline-block;
width: 100px;
float: left;
height: 100%;
font-size: 10px;
padding: 20px 18px;
}
.email {
width: 150px;
float: left;
display: inline-block;
height: 100%;
padding: 20px 18px;
font-size: 10px;
}
a.social-btn {
width: 20px;
height: 20px;
margin-top: 13px;
float: left;
}
a.social-btn.fb {
background: url("img/facebook#2x.png") 0% 0%/ 20px 20px no-repeat;
display: inline-block;
}
a.social-btn.tw {
background: url("img/twitter#2x.png") 0% 0% / 20px 20px no-repeat;
display: inline-block;
}
a.social-btn.ig {
background: url("img/instagram#2x.png") 0% 0% / 20px 20px no-repeat;
}
a.social-btn.gp {
background: url("img/google#2x.png") 0% 0% / 20px 20px no-repeat;
}
section {
width: 900px;
margin: 0 auto;
}
section#header .wrapper button.green-button {
text-decoration: none;
font-family: 'Raleway';
}
.green-button {
font-size: 13px;
display: inline-block;
height: 50px;
width: 170px;
/* float: left; */
right: 0;/* add */
position: absolute;/* add */
/* margin-left: 235px; */
padding: 6px 10px;
background-color: rgb(185, 233, 137);
color: rgb(43, 150, 190);
text-transform: uppercase;
border-radius: 0px;
border-width: 0px;
border-style: initial;
border-color: initial;
box-sizing: border-box;
}
<section id="header">
<div class="wrapper">
<div class="address">7542 Fay Ave Upstairs Suite, La Jolla, CA 92037</div>
<div class="phone">(858) 381-0740</div>
<div class="email">sdacneclinic#gmail.com</div>
<div class="social"><a class="social-btn fb" href="http://facebook.com"></a></div>
<div class="social"><a class="social-btn tw" href="http://twitter.com"></a></div>
<div class="social"><a class="social-btn ig" href="http://instagram.com"></a></div>
<div class="social"><a class="social-btn gp" href="https://plus.google.com"></a></div>
<button class="green-button">Book Consultation</button>
</div>
</section>
I am new to this, so I have this problem where the contents in the page will be shifted when the browser is minimized. When the browser is minimized, the contents including the logo will be shifted and the contents will be shifted out of the blue transparent background.
here is my css codes
#full-screen-background-image {
z-index: -999;
min-height: 100%;
min-width: 1300px;
width: 100%;
height: auto;
position: absolute;
top: 0;
left: 0;
}
.whole{
margin: 0px auto;
height: 1242px;
width: 1000px;
}
.clear{
margin: 0 auto;
clear: both;
}
.logo {
width: 460px;
height: 170px;
margin: 0 auto;
}
.fax {
margin: 0 auto;
width: 480px;
height: 110px;
margin-right: 267px;
}
.fax p {
color: white;
font-family: 'Istok Web', sans-serif;
font-size: 35px;
text-align:center;
float:left;
margin: 0 auto;
margin-top: 55px;
width: 394px;
}
.faxLogo{
float: left;
height:60px;
width: 60px;
margin: 0 auto;
margin-top: 40px;
margin-left: -385px;
}
.tel{
margin: 0 auto;
width: 480px;
height: 70px;
margin-right: 267px;
}
.telDetails{
float:left;
height: 10px;
}
.telLogo{
float: left;
height:60px;
width: 60px;
margin: 0 auto;
margin-top: -10px;
margin-left: 65px;
}
.tel p {
color: white;
font-family: 'Istok Web', sans-serif;
font-size: 35px;
text-align: center;
margin:0 auto;
margin-top: 10px;
margin-left: 10px;
}
.locationLogo{
float: left;
height: 60px;
width: 60px;
margin: 0 auto;
margin-left: 65px;
}
.location{
margin: 0 auto;
width: 500px;
}
.location p {
color: white;
font-family: 'Istok Web', sans-serif;
font-size: 35px;
float: left;
margin:0 auto;
margin-top: -35px;
margin-left: 160px;
line-height: 60px;
}
.detail1 {
margin: 0 auto;
text-align:center;
}
.detail1 p{
font-size: 45px;
font-family: 'Istok Web', sans-serif;
color:white;
text-align:center;
margin-left: 130px;
}
.detail2 {
font-size: 45px;
font-family: 'Istok Web', sans-serif;
color: white;
margin: 0 auto;
}
.detail2 p{
margin-top: -20px;
text-align:center;
margin-left: 45px;
}
here is my HTML codes
<div class="clear" style="height: 445px;"></div>
<div class="whole">
<div class="logo"><img src="images/logo_3.jpg" /></div>
<div class="clear" style="height:50px;"></div>
<div class="detail1">
<p>TEXT</p>
</div>
<div class="detail2">
<p>TEXT</p>
</div>
<div class="clear" style="margin-top:-53px;"></div>
<div class="location">
<div class="locationLogo">
<img src="images/location.png" />
</div>
<div class="locationDetails">
<p style="width: 500px;">TEXT<br />TEXT<br />TEXT</p>
</div>
</div>
<div class="tel">
<div class="telLogo" style="width: 10px;">
<img src="images/tel.png" />
</div>
<div class="telDetails">
<p style="width: 365px;">TEXT</p>
</div>
</div>
<div class="fax">
<div class="faxLogo" style="width: 10px;">
<img src="images/fax.png" />
</div>
<div class="faxDetails">
<p style="width: 394px;">TEXT</p>
</div>
</div>
</div>
Your content inside your transparent box moves when the window resizes but your transparent box is part of the background image. Use the oil rig as a background image and put your content in a div. Something like this:
.box {
width: 100%;
height: auto;
background-color: rgba(0,0,255,0.5);
}
<div class="box">
<ul>
<li>SOME CONTENT HERE</li>
<li>SOME CONTENT HERE</li>
<li>SOME CONTENT HERE</li>
<li>SOME CONTENT HERE</li>
</ul>
</div>
You can now place the div wherever you see fit on your page.
I'm trying to align several DIVS, Images and text and I can't figure this out..
Here's what I'm trying to achieve:
Heres' my HTML
<div class="section5">
<div class="outer">
<div class="container1">
<img src="icon.png" width="85">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
<div class="container2">
<img src="iphone.png" width="375">
<div class="subtitle2">Text</div>
</div>
</div>
</div>
Here is my CSS:
.section5{ height: 525px; background-color: #5e6172; text-align: center; position: relative;}
.outer{ width: 80%; background-color: #45da45; height: 100%; margin: 0 auto; position: relative;}
.title1{color: #ffffff; font-size: 2.6em; font-family: h35; }
.subtitle1{color: #ffffff; font-size: 1.5em; font-family: h35; margin-top: 0.25em; }
.subtitle2{color: #ffffff; font-size: 1.5em; font-family: h35; margin-top: 0.25em; }
.container1{display: block; background-color: #ccc; }
.container2{display: block; background-color: #fffc1e; }
Here is the JSFIDDLE:
http://jsfiddle.net/mib92/hogwohf8/
My current problems:
1) My text at the bottom needs to be on the right side of the image.. center like in my example image.
2) the bottom of my bottom picture must be align to the bottom of container2 AND the bottom of section5
3) While doing this, the container 1 must remain in the vertical middle of the remaining space of the section5.
Thank you
I hops it's help you.
.section5 {
height: 525px;
background-color: #5e6172;
text-align: center;
position: relative;
}
.outer {
width: 80%;
background-color: #45da45;
height: 100%;
margin: 0 auto;
position: relative;
}
.title1 {
color: #ffffff;
font-size: 2.6em;
font-family: h35;
}
.subtitle1 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.subtitle2 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.container1 {
display: block;
background-color: #ccc;
}
.container2 {
display: block;
background-color: #fffc1e;
}
.right-sied {
display: inline-block;
vertical-align: top;
width: 41%;
}
.left-sied {
display: inline-block;
width: 49%;
}
.left-sied img {
max-width: 100%;
}
<div class="section5">
<div class="outer">
<div class="container1">
<img src="icon.png" width="85">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
<div class="container2">
<div class="left-sied">
<img src="iphone.png" width="375">
</div>
<div class="right-sied">
<div class="subtitle2">Text</div>
</div>
</div>
</div>
</div>
Live Demo
check this:
.section5 {
height: 525px;
background-color: #5e6172;
text-align: center;
position: relative;
}
.outer {
width: 80%;
background-color: #45da45;
height: 100%;
margin: 0 auto;
position: relative;
}
.title1 {
color: #ffffff;
font-size: 2.6em;
font-family: h35;
}
.subtitle1 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.subtitle2 {
color: #ffffff;
font-size: 1.5em;
font-family: h35;
margin-top: 0.25em;
}
.container1 {
display: block;
background-color: #ccc;
}
.container2 {
display: block;
background-color: #fffc1e;
}
.container1 .wrapper {
display: inline-block;
float: right;
}
.container2 img {
margin: 0 auto;
}
<div class="section5">
<div class="outer">
<div class="container1">
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg" width="85">
<div class="wrapper">
<div class="title1">Text</div>
<div class="subtitle1">Text</div>
</div>
</div>
<div class="container2">
<div class="subtitle2">Text</div>
<img src="http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg" width="375">
</div>
</div>
</div>