I got a place on my CSS Grid where I am inserting a paragraph of about 15 characters long, I would like to add a background element to it and I want it to have some personality so am using a inline SVG content.
I tried to place it at the bottom with a position:relative but when you change the view-port size it doesn't scale well. I wrapped the SVG code in a container:
.marquee-container {
height: 0;
position: absolute;
width: 500px;
}
And the styles of the SVG:
.svg-marquee {
fill: teal;
stroke-width: 4;
stroke-miterlimit: 10;
cursor: pointer;
transition: .5s;
}
This is the HTML Markup
<div class="home-works">
<div class="head">
<h1>Entries</h1>
</div>
<img class="thumbnail" src="img/profile-picture.png" width="100%"/>
<div class="main-content">
<div class="marquee-container">
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" viewBox="0 0 634 175" style="enable-background:new 0 0 634 175;"
xml:space="preserve">
<path class="svg-marquee" d="M595.9,173C317,173,317,153,38.1,153C27.3,153,2,157.6,2,151C2,87.5,34.8,87.5,34.8,24c0-6.6-7.5-22,3.3-22
C317,2,317,22,595.9,22c10.8,0,36.1-4.6,36.1,2c0,63.5-32.8,63.5-32.8,127C599.2,157.6,606.7,173,595.9,173z"/>
</svg>
</div>
<div class="post">
<h3>title</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempore placeat
maiores ad ullam illo, blanditiis ipsam libero! Aspernatur, mollitia suscipit?
</p>
</div>
</div>
</div>
My item is inside a CSS Grid Layout where post is the class I am using to style the contents of the paragraph. Which is not inside any grid-template-areas, its just a class within an area already defined.
.post {
text-align: left;
position: relative;
z-index: 1;
}
So the scaling doesn't go well, I would like to place the element at the background of the paragraph to be contained, what is the best approach?
.marquee-container {
height: 0;
position: absolute;
width: 500px;
}
.svg-marquee {
fill: teal;
stroke-width: 4;
stroke-miterlimit: 10;
cursor: pointer;
transition: .5s;
}
.post {
text-align: left;
position: relative;
z-index: 1;
}
<div class="home-works">
<div class="head">
<h1>Entries</h1>
</div>
<img class="thumbnail" src="img/profile-picture.png" width="100%" />
<div class="main-content">
<div class="marquee-container">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" viewBox="0 0 634 175" style="enable-background:new 0 0 634 175;" xml:space="preserve">
<path class="svg-marquee" d="M595.9,173C317,173,317,153,38.1,153C27.3,153,2,157.6,2,151C2,87.5,34.8,87.5,34.8,24c0-6.6-7.5-22,3.3-22
C317,2,317,22,595.9,22c10.8,0,36.1-4.6,36.1,2c0,63.5-32.8,63.5-32.8,127C599.2,157.6,606.7,173,595.9,173z"/>
</svg>
</div>
<div class="post">
<h3>title</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempore placeat maiores ad ullam illo, blanditiis ipsam libero! Aspernatur, mollitia suscipit?
</p>
</div>
</div>
</div>
Since you are positioning the .marquee-container absolutely.
You need a parent to have position set to relative, So, add position: relative on the parent .main-content.
I don't understand why you set the .marquee-container height to 0.
I would suggest set it's height to auto and have a bottom: 0;, (As you wanted it to be aligned to bottom of the container).
Set the width to 100% since you want it to be scalable. also add a negative z-index so that the element doesn't cover up the contents.
Check the snippet below.
.main-content {
position: relative;
}
.marquee-container {
position: absolute;
bottom: 0;
height: auto;
width: 100%;
z-index: -5;
}
.svg-marquee {
fill: teal;
stroke-width: 4;
stroke-miterlimit: 10;
cursor: pointer;
transition: .5s;
}
.post {
text-align: left;
position: relative;
z-index: 1;
}
<div class="home-works">
<div class="head">
<h1>Entries</h1>
</div>
<img class="thumbnail" src="img/profile-picture.png" width="100%" />
<div class="main-content">
<div class="marquee-container">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" viewBox="0 0 634 175" style="enable-background:new 0 0 634 175;" xml:space="preserve">
<path class="svg-marquee" d="M595.9,173C317,173,317,153,38.1,153C27.3,153,2,157.6,2,151C2,87.5,34.8,87.5,34.8,24c0-6.6-7.5-22,3.3-22
C317,2,317,22,595.9,22c10.8,0,36.1-4.6,36.1,2c0,63.5-32.8,63.5-32.8,127C599.2,157.6,606.7,173,595.9,173z"/>
</svg>
</div>
<div class="post">
<h3>title</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempore placeat maiores ad ullam illo, blanditiis ipsam libero! Aspernatur, mollitia suscipit?
</p>
</div>
</div>
</div>
Related
The document appears a strange white line in right of the page.All my width is 100% or with margin to be centered but this line is already here and I can not understand why.I sow in another part of the stackOverflow that position:relative is problem in navigation bar or other elements in HTML but I try just to delete them but that do not solve the problem.At the end how can I remove this line?
/* Global */
#import url("https://fonts.googleapis.com/css?family=Roboto&display=swap");
body {
margin: 0;
padding: 0;
line-height: 1.6;
font-size: 17px;
font-family: "Roboto", sans-serif;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
.colored {
color: #e86c00;
}
/* Local */
/* navigation bar */
#headNavigation {
display: block;
height: 110px;
width: 100%;
background: #222;
}
ul {
margin: 0;
padding: 0;
text-align: center;
list-style-type: none;
position: relative;
bottom: 50px;
}
ul li {
display: inline-block;
padding: 25px 20px 0 20px;
text-align: center;
opacity: 0.2;
position: relative;
bottom: 20px;
left: 20%;
}
ul li a {
text-decoration: none !important;
text-transform: uppercase;
letter-spacing: 3px;
color: #fff;
}
nav h1 {
color: #fff;
position: relative;
top: 30px;
left: 30px;
}
.bi {
display: block;
margin: 10px auto;
}
ul li:hover,
ul li:hover .menu-title {
opacity: 1;
color: #e86c00;
}
.active a {
color: #e86c00;
}
.active {
opacity: 1;
}
/* section with photos */
.slider {
position: relative;
overflow: hidden;
height: 80vh;
width: 100%;
}
.slide {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: opacity 0.4s ease-in-out;
}
.content {
position: absolute;
bottom: 70px;
left: -600px;
opacity: 0;
width: 600px;
background-color: rgba(255, 255, 255, 0.6);
color: #333;
padding: 35px;
}
.slide .content h1 {
margin-bottom: 10px;
}
.slide.current .content {
opacity: 1;
transform: translateX(600px);
transition: all 0.7s ease-in-out 0.3s;
}
.buttons button#next {
position: absolute;
top: 50%;
right: 15px;
}
.buttons button#prev {
position: absolute;
top: 50%;
left: 15px;
}
.buttons button {
border: 2px solid #fff;
background-color: transparent;
color: #fff;
padding: 10px 12px;
border-radius: 50%;
outline: none;
}
.buttons button:hover {
background-color: #fff;
color: #333;
}
.slide.current {
opacity: 1;
}
.slide:first-child {
background: url(../photos/pic1.jpg) no-repeat center center/cover;
}
.slide:nth-child(2) {
background: url(../photos/pic8.jpg) no-repeat center center/cover;
}
.slide:nth-child(3) {
background: url(../photos/pic3.jpg) no-repeat center center/cover;
}
.slide:nth-child(4) {
background: url(../photos/pic7.jpg) no-repeat center center/cover;
}
.slide:nth-child(5) {
background: url(../photos/pic5.jpg) no-repeat center center/cover;
}
.slide:nth-child(6) {
background: url(../photos/pic6.jpg) no-repeat center center/cover;
}
/* artivle for subscribe */
.sub {
height: 150px;
width: 100%;
color: #fff;
background-color: #222222;
}
#subscribeForm {
float: right;
}
#subscribeForm input[type="email"] {
height: 40px;
width: 350px;
position: relative;
right: 150px;
border: none;
text-align: center;
}
#subscribeForm input[type="submit"] {
height: 45px;
width: 150px;
position: relative;
right: 140px;
background-color: #eb4034;
border: none;
color: #fff;
}
.sub h1 {
position: relative;
top: 50px;
left: 25px;
}
/* article with courses */
.courses {
position: relative;
overflow: hidden;
height: auto;
width: 100%;
text-align: center;
}
.course {
display: block;
height: 250px;
width: 30%;
float: left;
margin: 60px 0 50px 35px;
}
.courseImage {
display: block;
height: 150px;
width: 60%;
margin: 0 auto 15px;
}
.course a {
text-decoration: none;
color: #e86c00;
}
/* Created by JS */
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous" />
<script src="https://kit.fontawesome.com/839b1040bb.js" crossorigin="anonymous"></script>
<header>
<nav id="headNavigation">
<h1>
Be
<span data-name="[positive , motivated]" data-wait="3000" class="colored">creative</span
>
</h1>
<ul>
<li class="active">
<svg
class="bi bi-house"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M2 13.5V7h1v6.5a.5.5 0 00.5.5h9a.5.5 0 00.5-.5V7h1v6.5a1.5 1.5 0 01-1.5 1.5h-9A1.5 1.5 0 012 13.5zm11-11V6l-2-2V2.5a.5.5 0 01.5-.5h1a.5.5 0 01.5.5z"
clip-rule="evenodd"
/>
<path
fill-rule="evenodd"
d="M7.293 1.5a1 1 0 011.414 0l6.647 6.646a.5.5 0 01-.708.708L8 2.207 1.354 8.854a.5.5 0 11-.708-.708L7.293 1.5z"
clip-rule="evenodd"
/>
</svg>
Home
</li>
<li>
<svg
class="bi bi-eject"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M7.27 1.047a1 1 0 011.46 0l6.345 6.77c.6.638.146 1.683-.73 1.683H1.656C.78 9.5.326 8.455.926 7.816L7.27 1.047zM14.346 8.5L8 1.731 1.654 8.5h12.692zM.5 11.5a1 1 0 011-1h13a1 1 0 011 1v1a1 1 0 01-1 1h-13a1 1 0 01-1-1v-1zm14 0h-13v1h13v-1z"
clip-rule="evenodd"
/>
</svg>
About
</li>
<li>
<svg
class="bi bi-chat"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M2.678 11.894a1 1 0 01.287.801 10.97 10.97 0 01-.398 2c1.395-.323 2.247-.697 2.634-.893a1 1 0 01.71-.074A8.06 8.06 0 008 14c3.996 0 7-2.807 7-6 0-3.192-3.004-6-7-6S1 4.808 1 8c0 1.468.617 2.83 1.678 3.894zm-.493 3.905a21.682 21.682 0 01-.713.129c-.2.032-.352-.176-.273-.362a9.68 9.68 0 00.244-.637l.003-.01c.248-.72.45-1.548.524-2.319C.743 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7-3.582 7-8 7a9.06 9.06 0 01-2.347-.306c-.52.263-1.639.742-3.468 1.105z"
clip-rule="evenodd"
/>
</svg>
Feedback
</li>
<li>
<svg
class="bi bi-box-arrow-in-right"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M8.146 11.354a.5.5 0 010-.708L10.793 8 8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708 0z"
clip-rule="evenodd"
/>
<path
fill-rule="evenodd"
d="M1 8a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9A.5.5 0 011 8z"
clip-rule="evenodd"
/>
<path
fill-rule="evenodd"
d="M13.5 14.5A1.5 1.5 0 0015 13V3a1.5 1.5 0 00-1.5-1.5h-8A1.5 1.5 0 004 3v1.5a.5.5 0 001 0V3a.5.5 0 01.5-.5h8a.5.5 0 01.5.5v10a.5.5 0 01-.5.5h-8A.5.5 0 015 13v-1.5a.5.5 0 00-1 0V13a1.5 1.5 0 001.5 1.5h8z"
clip-rule="evenodd"
/>
</svg>
Log In
</li>
</ul>
</nav>
<div class="lighter"></div>
</header>
<section>
<div class="slider">
<div class="slide current">
<div class="content">
<h1>Henry Park</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Peter Bottom(wizard)</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Annie Granger</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Miriam (Mitzi)</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Julie Wothson</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Mabel Tven</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
</div>
<div class="buttons">
<button id="prev"><i class="fas fa-arrow-left "></i></button>
<button id="next"><i class="fas fa-arrow-right "></i></button>
</div>
</section>
<article>
<div class="sub">
<h1>
Please <span class="colored">Subscribe</span> for
<span class="colored">our</span> site
</h1>
<form id="subscribeForm">
<input type="email" name="Sub Email" id="SubEmail" placeholder="Enter Email" />
<input type="submit" value="Submit" />
</form>
</div>
</article>
<article>
<div class="container">
<div class="courses">
<div class="course">
<div class="image">
<img src="/photos/photoShop.png" alt="Adobe photoShop" class="courseImage" />
</div>
Photo Shop course
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/photoEditingCourse.jpg" alt="Editing course" class="courseImage" />
</div>
Photo Editing Course
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/beIntoPhoto.jpg" alt="be into" class="courseImage" />
</div>
Be into photo
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/photoMarketing.jpg" alt="Photo Marketing" class="courseImage" />
</div>
Photo marketing with Ed Brand
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/creativiy.jpg" alt="Creativity" class="courseImage" />
</div>
Creativity with Adam Bauman
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
</div>
</div>
</article>
<footer>
<h5>NO COPYRIGHT ©</h5>
<div class="sectionOfPartners">
<h6>Partners</h6>
<p>Partner 1</p>
<p>Partner 2</p>
<p>Partner 3</p>
<p>Partner 4</p>
<p>Partner 5</p>
<p>Partner 6</p>
<p>Partner 7</p>
</div>
<div class="sectionOfContacts">
<p>Oficial telephone +XXX / XXX XXXX</p>
<p>Contact with workers +XXX / XXX XXXX</p>
<p>Other Contacts Contact</p>
</div>
</footer>
There are 2 headers (nav h1 & .sub h1 )and ul li have overflow issue because of the relative position.
nav h1 & .sub h1: left -> padding-left
ul li: remove left:20%
/* Global */
#import url("https://fonts.googleapis.com/css?family=Roboto&display=swap");
body {
margin: 0;
padding: 0;
line-height: 1.6;
font-size: 17px;
font-family: "Roboto", sans-serif;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
.colored {
color: #e86c00;
}
/* Local */
/* navigation bar */
#headNavigation {
display: block;
height: 110px;
width: 100%;
background: #222;
}
ul {
margin: 0;
padding: 0;
text-align: center;
list-style-type: none;
position: relative;
bottom: 50px;
}
ul li {
display: inline-block;
padding: 25px 20px 0 20px;
text-align: center;
opacity: 0.2;
position: relative;
bottom: 20px;
}
ul li a {
text-decoration: none !important;
text-transform: uppercase;
letter-spacing: 3px;
color: #fff;
}
nav h1 {
color: #fff;
position: relative;
top: 30px;
padding-left: 30px;
}
.bi {
display: block;
margin: 10px auto;
}
ul li:hover,
ul li:hover .menu-title {
opacity: 1;
color: #e86c00;
}
.active a {
color: #e86c00;
}
.active {
opacity: 1;
}
/* section with photos */
.slider {
position: relative;
overflow: hidden;
height: 80vh;
width: 100%;
}
.slide {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: opacity 0.4s ease-in-out;
}
.content {
position: absolute;
bottom: 70px;
left: -600px;
opacity: 0;
width: 600px;
background-color: rgba(255, 255, 255, 0.6);
color: #333;
padding: 35px;
}
.slide .content h1 {
margin-bottom: 10px;
}
.slide.current .content {
opacity: 1;
transform: translateX(600px);
transition: all 0.7s ease-in-out 0.3s;
}
.buttons button#next {
position: absolute;
top: 50%;
right: 15px;
}
.buttons button#prev {
position: absolute;
top: 50%;
left: 15px;
}
.buttons button {
border: 2px solid #fff;
background-color: transparent;
color: #fff;
padding: 10px 12px;
border-radius: 50%;
outline: none;
}
.buttons button:hover {
background-color: #fff;
color: #333;
}
.slide.current {
opacity: 1;
}
.slide:first-child {
background: url(../photos/pic1.jpg) no-repeat center center/cover;
}
.slide:nth-child(2) {
background: url(../photos/pic8.jpg) no-repeat center center/cover;
}
.slide:nth-child(3) {
background: url(../photos/pic3.jpg) no-repeat center center/cover;
}
.slide:nth-child(4) {
background: url(../photos/pic7.jpg) no-repeat center center/cover;
}
.slide:nth-child(5) {
background: url(../photos/pic5.jpg) no-repeat center center/cover;
}
.slide:nth-child(6) {
background: url(../photos/pic6.jpg) no-repeat center center/cover;
}
/* artivle for subscribe */
.sub {
height: 150px;
width: 100%;
color: #fff;
background-color: #222222;
}
#subscribeForm {
float: right;
}
#subscribeForm input[type="email"] {
height: 40px;
width: 350px;
position: relative;
right: 150px;
border: none;
text-align: center;
}
#subscribeForm input[type="submit"] {
height: 45px;
width: 150px;
position: relative;
right: 140px;
background-color: #eb4034;
border: none;
color: #fff;
}
.sub h1 {
position: relative;
top: 50px;
padding-left: 25px;
}
/* article with courses */
.courses {
position: relative;
overflow: hidden;
height: auto;
width: 100%;
text-align: center;
}
.course {
display: block;
height: 250px;
width: 30%;
float: left;
margin: 60px 0 50px 35px;
}
.courseImage {
display: block;
height: 150px;
width: 60%;
margin: 0 auto 15px;
}
.course a {
text-decoration: none;
color: #e86c00;
}
/* Created by JS */
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous" />
<script src="https://kit.fontawesome.com/839b1040bb.js" crossorigin="anonymous"></script>
<header>
<nav id="headNavigation">
<h1>
Be
<span data-name="[positive , motivated]" data-wait="3000" class="colored">creative</span
>
</h1>
<ul>
<li class="active">
<svg
class="bi bi-house"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M2 13.5V7h1v6.5a.5.5 0 00.5.5h9a.5.5 0 00.5-.5V7h1v6.5a1.5 1.5 0 01-1.5 1.5h-9A1.5 1.5 0 012 13.5zm11-11V6l-2-2V2.5a.5.5 0 01.5-.5h1a.5.5 0 01.5.5z"
clip-rule="evenodd"
/>
<path
fill-rule="evenodd"
d="M7.293 1.5a1 1 0 011.414 0l6.647 6.646a.5.5 0 01-.708.708L8 2.207 1.354 8.854a.5.5 0 11-.708-.708L7.293 1.5z"
clip-rule="evenodd"
/>
</svg>
Home
</li>
<li>
<svg
class="bi bi-eject"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M7.27 1.047a1 1 0 011.46 0l6.345 6.77c.6.638.146 1.683-.73 1.683H1.656C.78 9.5.326 8.455.926 7.816L7.27 1.047zM14.346 8.5L8 1.731 1.654 8.5h12.692zM.5 11.5a1 1 0 011-1h13a1 1 0 011 1v1a1 1 0 01-1 1h-13a1 1 0 01-1-1v-1zm14 0h-13v1h13v-1z"
clip-rule="evenodd"
/>
</svg>
About
</li>
<li>
<svg
class="bi bi-chat"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M2.678 11.894a1 1 0 01.287.801 10.97 10.97 0 01-.398 2c1.395-.323 2.247-.697 2.634-.893a1 1 0 01.71-.074A8.06 8.06 0 008 14c3.996 0 7-2.807 7-6 0-3.192-3.004-6-7-6S1 4.808 1 8c0 1.468.617 2.83 1.678 3.894zm-.493 3.905a21.682 21.682 0 01-.713.129c-.2.032-.352-.176-.273-.362a9.68 9.68 0 00.244-.637l.003-.01c.248-.72.45-1.548.524-2.319C.743 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7-3.582 7-8 7a9.06 9.06 0 01-2.347-.306c-.52.263-1.639.742-3.468 1.105z"
clip-rule="evenodd"
/>
</svg>
Feedback
</li>
<li>
<svg
class="bi bi-box-arrow-in-right"
width="2em"
height="2em"
viewBox="0 0 16 16"
fill="#fff"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M8.146 11.354a.5.5 0 010-.708L10.793 8 8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708 0z"
clip-rule="evenodd"
/>
<path
fill-rule="evenodd"
d="M1 8a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9A.5.5 0 011 8z"
clip-rule="evenodd"
/>
<path
fill-rule="evenodd"
d="M13.5 14.5A1.5 1.5 0 0015 13V3a1.5 1.5 0 00-1.5-1.5h-8A1.5 1.5 0 004 3v1.5a.5.5 0 001 0V3a.5.5 0 01.5-.5h8a.5.5 0 01.5.5v10a.5.5 0 01-.5.5h-8A.5.5 0 015 13v-1.5a.5.5 0 00-1 0V13a1.5 1.5 0 001.5 1.5h8z"
clip-rule="evenodd"
/>
</svg>
Log In
</li>
</ul>
</nav>
<div class="lighter"></div>
</header>
<section>
<div class="slider">
<div class="slide current">
<div class="content">
<h1>Henry Park</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Peter Bottom(wizard)</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Annie Granger</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Miriam (Mitzi)</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Julie Wothson</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
<div class="slide ">
<div class="content">
<h1>Mabel Tven</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Odio,
eos quidem quia quis maiores provident suscipit Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Perferendis, unde.
</p>
</div>
</div>
</div>
<div class="buttons">
<button id="prev"><i class="fas fa-arrow-left "></i></button>
<button id="next"><i class="fas fa-arrow-right "></i></button>
</div>
</section>
<article>
<div class="sub">
<h1>
Please <span class="colored">Subscribe</span> for
<span class="colored">our</span> site
</h1>
<form id="subscribeForm">
<input type="email" name="Sub Email" id="SubEmail" placeholder="Enter Email" />
<input type="submit" value="Submit" />
</form>
</div>
</article>
<article>
<div class="container">
<div class="courses">
<div class="course">
<div class="image">
<img src="/photos/photoShop.png" alt="Adobe photoShop" class="courseImage" />
</div>
Photo Shop course
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/photoEditingCourse.jpg" alt="Editing course" class="courseImage" />
</div>
Photo Editing Course
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/beIntoPhoto.jpg" alt="be into" class="courseImage" />
</div>
Be into photo
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/photoMarketing.jpg" alt="Photo Marketing" class="courseImage" />
</div>
Photo marketing with Ed Brand
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
<div class="course">
<div class="image">
<img src="/photos/creativiy.jpg" alt="Creativity" class="courseImage" />
</div>
Creativity with Adam Bauman
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptates minus nam ipsa vel libero tempore necessitatibus deserunt maiores amet laborum!
</p>
</div>
</div>
</div>
</article>
<footer>
<h5>NO COPYRIGHT ©</h5>
<div class="sectionOfPartners">
<h6>Partners</h6>
<p>Partner 1</p>
<p>Partner 2</p>
<p>Partner 3</p>
<p>Partner 4</p>
<p>Partner 5</p>
<p>Partner 6</p>
<p>Partner 7</p>
</div>
<div class="sectionOfContacts">
<p>Oficial telephone +XXX / XXX XXXX</p>
<p>Contact with workers +XXX / XXX XXXX</p>
<p>Other Contacts Contact</p>
</div>
</footer>
The green line should be drawn threw until the bottom as a timeline. The length is calculated by each sections of unique cssgrid height in JavaScript.
All entries look absolutely the same by codebase, but for any reason only the topmost is displayed.
I've tried to play around with position: absolute and position: relative for both the content and the green line, but it didn't work.
Is there something hidden or above the other?
#cssgrid {
display: grid;
grid-template-columns: 50px auto;
grid-template-rows: 60px 40xp auto;
grid-template-areas: "b h" "b t" "b d";
}
<div>
<div id="line" style="position: absolute;"></div>
<div id="cssgrid">
<div id="grid-bulletpoint">
<div class="bulletpoint"></div>
</div>
<div id="grid-headline">
<h2>...</h2>
</div>
<div id="grid-time">
<p>...</p>
</div>
<div id="grid-description">
<p>...</p>
</div>
</div>
</div>
You can use the pseudo class :before to add the dot by making it position:absolute.
#cssgrid {
margin-left: 100px;
}
.boxContainer {
border-left: 5px solid green;
padding-left: 37px;
margin-bottom: -20px;
padding-top: 20px;
}
.grid-headline {
position: relative;
}
.grid-headline:before {
content: ' ';
width: 20px;
height: 20px;
background: orange;
position: absolute;
left: -50px;
top: 0;
border-radius: 50%;
}
#grid-description p {
margin-bottom: 0;
}
<div id="cssgrid">
<div class="boxContainer">
<div class="grid-headline">
<h2>Entry</h2>
</div>
<div id="grid-time">
<p>1989</p>
</div>
<div id="grid-description">
<p>Lorem ipsum text...</p>
</div>
</div>
<div class="boxContainer">
<div class="grid-headline">
<h2>Entry</h2>
</div>
<div id="grid-time">
<p>1989</p>
</div>
<div id="grid-description">
<p>Lorem ipsum text...</p>
</div>
</div>
</div>
You may organize differently your grid. See the Timeline Grid here This is the beauty of CSS Grid in my opinion.
Check this code:
(At the end I added the code for the svg if you want to use it too)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Grid CSS Timelin</title>
<style>
#thetime {
display: grid;
grid-template-columns: 50px 1fr;
grid-template-rows: 1fr 1fr 1fr;
}
#timeline {
background-color: rgba(193, 240, 104, 0.36);
border: 1px solid #0031ff;
justify-self: center;
}
.timebar {
width: 10px;
height: 100%;
color: transparent;
background-color: #00ff1d;
}
ul {
list-style: none;
justify-self: start;
margin-left: 0;
padding: 0;
}
li {
background-color: rgba(141, 240, 240, 0.36);
border: 1px solid #ff00ff;
margin: 1.5 rem 0;
position: relative;
}
li:before {
content: " ";
background-size: cover;
background-image: url("/circle2.svg");
width: 1.5rem;
height: 1.5rem;
position: absolute;
left: -2.3rem;
margin-top: 1.25rem;
}
h2 {
}
time {
font-family: monospace;
}
p {
}
</style>
</head>
<body>
<section id="thetime">
<div id="timeline">
<div class="timebar">X</div>
</div>
<ul>
<li>
<h2>
Entry #1
</h2>
<time>
01.01.1900 - 31.12.1900
</time>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minus aperiam praesentium totam nihil, molestiae officiis reiciendis voluptatum numquam! Ab inventore quos repudiandae, accusamus quibusdam blanditiis facere optio asperiores aliquam consectetur.
</p>
</li>
<li>
<h2>
Entry #2
</h2>
<time>
01.01.1900 - 31.12.1900
</time>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minus aperiam praesentium totam nihil, molestiae officiis reiciendis voluptatum numquam! Ab inventore quos repudiandae, accusamus quibusdam blanditiis facere optio asperiores aliquam consectetur.
</p>
</li>
<li>
<h2>
Entry #3
</h2>
<time>
01.01.1900 - 31.12.1900
</time>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minus aperiam praesentium totam nihil, molestiae officiis reiciendis voluptatum numquam! Ab inventore quos repudiandae, accusamus quibusdam blanditiis facere optio asperiores aliquam consectetur.
</p>
</li>
<li>
<h2>
Entry #4
</h2>
<time>
01.01.1900 - 31.12.1900
</time>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minus aperiam praesentium totam nihil, molestiae officiis reiciendis voluptatum numquam! Ab inventore quos repudiandae, accusamus quibusdam blanditiis facere optio asperiores aliquam consectetur.
</p>
</li>
</ul>
</section>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFF00;}
</style>
<circle class="st0" cx="10" cy="10" r="10"/>
</svg>
In this code, I put two images over each other using absolute positioning, but the second div with class row seems to be hidden behind the images. How can I fix that and make it appear in its correct place (after the images)?
.composition {
position: relative;
}
.img-1 {
position: absolute;
top: 0;
left: 0;
}
.img-2 {
position: absolute;
top: 0;
left: 0;
}
<div class="row">
<div class="composition">
<img src="imgs/lenses.jpg" class="img-fluid img-1" alt="" />
<img src="imgs/mountain-1.jpg" class="img-fluid img-2" alt="" />
</div>
</div>
<div class="row">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita praesentium inventore iusto rem perspiciatis impedit.
</div>
As previously stated, the absolute positioning on the images is causing .composition to not have a height and the div below it to collapse under the images.
Why do both images need to be absolutely positioned? Leave one image without the absolute positioning so the .composition has a height of the image. The second image can be positioned absolutely to cover the first.
With the first image staying in the flow and keeping a height, the second div will remain below the images.
.composition {
position: relative;
}
.img-2 {
position: absolute;
top: 0;
left: 0;
}
<body>
<div class="row">
<div class="composition">
<img src="https://picsum.photos/id/237/100/100" class="img-fluid img-1" alt="">
<img src="https://picsum.photos/id/1021/100/100" class="img-fluid img-2" alt="">
</div>
</div>
<div class="row">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita praesentium inventore iusto rem perspiciatis impedit.
</div>
Just change the position:absolute to position:relative for images.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<style type="text/css">
.composition {
position: relative;
}
.img-1 {
position: relative;
top: 0;
left: 0;
width: 100px;
height: 150px;
}
.img-2 {
position: relative;
top: 0;
left: 0;
width: 100px;
height: 150px;
}
</style>
<body>
<div class="row">
<div class="composition">
<img src="https://i.ebayimg.com/images/g/lAgAAOSwWAhcFLHg/s-l300.jpg" class="img-fluid img-1" alt="" />
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1bHL-HroyjayQ-OzEENg90I7a6CdtNRnn6l7KdSC8LlXr7H5w" class="img-fluid img-2" alt="" />
</div>
</div>
<div class="row">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita praesentium inventore iusto rem perspiciatis impedit.
</div>
</body>
</html>
I have a shape I'm trying to put on top of a text box with a background image. This shape will go in different sized containers and scale responsively. The issue I'm having is the background image scales as well, and I would like for it to stay the same size without using a clip path. Please see the code for what I'm talking about. This is driving me crazy!
.container {
width: 75%;
}
.box {
background-image: url("https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg");
padding-top: 5px;
padding-left: 25px;
padding-right: 20px;
padding-bottom: 5px;
margin-top: -5px;
}
p {
color: white;
}
<div class="container">
<svg width="100%" height="auto" viewBox="375 265 1268 45.3">
<defs>
<pattern id="img1" height="30%" width="30%"
patternContentUnits="objectBoundingBox"
viewBox="0 0 1 1" preserveAspectRatio="xMidYMid slice">
<image height="1" width="1" preserveAspectRatio="xMidYMid slice"
xlink:href="https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg" />
</pattern>
</defs>
<path d="M369,291.8v19.7h1280v-22.7c0,0-137-21.6-277-21.6c-308,0-534,34.9-726,34.9C460,302.2,369,291.8,369,291.8z" fill="url(#img1)" />
</svg>
<div class="box">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nec tamen ille erat sapiens quis enim hoc aut quando aut ubi aut unde
</p>
</div>
If you change the percentage size of the container, you'll see what I'm talking about.
Thanks for the help!
For a start you will need to get rid of the viewBox in the SVG. That causes the SVG to get scaled, and that affects anything in the SVG. You'll also want the pattern to be 1:1, so that means switching to patternContentUnits="userSpaceOnUse" and have the pattern use the image at actual size.
We are also using overflow:hidden so that the non-scaling SVG will not force the parent SVG to be wider.
This gets you close. The pattern is now 1:1 but it doesn't exactly line up with the HTML one because they have differing pattern origins. You can adjust that by tweaking the x and y attributes of the pattern until it lines up correctly. I'll leave that to you.
.container {
width: 75%;
overflow: hidden;
}
.box {
background-image: url("https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg");
padding-top: 5px;
padding-left: 25px;
padding-right: 20px;
padding-bottom: 5px;
margin-top: -5px;
}
p {
color: white;
}
<div class="container">
<svg width="1268" height="45.3">
<defs>
<pattern id="img1" patternUnits="userSpaceOnUse" width="881" height="192">
<image width="881" height="192"
xlink:href="https://s22.postimg.org/dhkk3e8sh/Blue_881.jpg" />
</pattern>
</defs>
<path transform="translate(-375 -265)"
d="M369,291.8v19.7h1280v-22.7c0,0-137-21.6-277-21.6c-308,0-534,34.9-726,34.9C460,302.2,369,291.8,369,291.8z" fill="url(#img1)" />
</svg>
<div class="box">
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nec tamen ille erat sapiens quis enim hoc aut quando aut ubi aut unde
</p>
</div>
I am trying to accomplish
IMG + text in one row, like in this example
I would like the image to be responsive somehow... so when I resize the window, the image remains there, but also text with background...
Also, I need the text to be vertically aligned... any ideas?
Any help is greatly appreciated! thanks
This may help you, later you can control with media-queries and place your image or content wherever you want.
.img-text {
width: 100%;
display: table;
table-layout: fixed;
}
.photo,
.content {
display: table-cell;
vertical-align: middle;
}
.photo {
width: 40%;
}
.photo img {
max-width: 100%;
height: auto;
}
.content {
width: 60%;
padding: 15px;
}
<div class="img-txt">
<div class="photo">
<img src="http://lorempixel.com/image_output/people-q-c-640-480-6.jpg" alt="">
</div>
<div class="content">
<h1>Something</h1>
<p>Something more</p>
<p>You should have tried yourself first, then asked with your code as example</p>
</div>
</div>
It would be really good if you had posted some of your code. I have already done a similar example, which I would like to share. You need to use positioning for this case. This is a case of fixed-fluid:
+-------+-----------+
| FIXED | FLUUUUUID |
+-------+-----------+
Or
+-------+-----------+
| FIXED | FLUUUUUID |
| | FLUUUUUID |
+-------+-----------+
Fixed-Fluid Model. In my snippet, I have demonstrated two kinds of examples. In the first case, the fluid is less in size. And the next has too long content.
Snippet
.parent {position: relative; margin: 0 0 15px; border: 1px solid #999; padding: 5px; padding-left: 100px;}
.parent .fixed {position: absolute; left: 5px; width: 90px; background-color: #99f;}
.parent .fluid {background-color: #f99;}
<div class="parent">
<div class="fixed">Fixed</div>
<div class="fluid">Fluid</div>
</div>
<div class="parent">
<div class="fixed">Fixed</div>
<div class="fluid">Fluid Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque animi placeat, expedita tempora explicabo facilis nulla fuga recusandae officia, maiores porro eaque, dolore et modi in sapiente accusamus id aut.</div>
</div>
Working Snippet
.parent {position: relative; margin: 0 0 15px; padding: 5px; padding-left: 100px; min-height: 50px;}
.parent .fixed {position: absolute; left: 5px; width: 90px; background-color: #99f;}
.parent .fluid {}
<div class="parent">
<div class="fixed">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADsUlEQVR4nO3aS4gcVRTG8TsTgjMxCCoYo1ExulCjLjRCGElwISooLgRF1JWjIaIYooIQH5gsghtfIBoiAWeCCLoRxYX4IAjqJkpEXWlAUUQUQWMyMer0z0VVOzVl3X5NV3dPT/2hF9P3u4dzvuqpOvfWDaGioqKioqKiYgDBJjyMLTi13/n0DIzjdfP5BTf0O7eegOcUcxjn9ju/UsEYjkUMgB39zrFUcFaD4uHlfudYKji7iQFT/c6xNHAS3l2SBmAVPmlS/PAZgBFsxm8tFD9cBuBMvNFi4cNjAM7DNP5qs/jFbQBW41nMdFD44jQAo7gWr+H4Agrv2ACsxc162UViPZ7CD10oumMD8Dhm07k17Cyj2DFcjSckz/E/ulx0RwbgskiMG/PCk3E9NmKkSdDVabFbsQcf4fcSC85TaABWYGXuu8lIjEMYq4suxU+ZwTcxgVsla/EX8Da+wtGSimqHqVyRJ0guxHH8g30YT8eubBDnznqAZq3noJE34OkCzXRm/MNInI/rgp9LS7Uc8gZ8U6CpYUM6fkX6dxEXBK23oINC3oADEd2rGc37Ec29QW9vYN0gb8DmiO5PrEg1d0c000G5j6wyyBuwHN9GtFelmosj4wcDjpSRZYn87zGI5yPae9LxZeaaoSzfBwvry/tBkQFbI9rHMppfC8ZngsYbkINIkQEPRrSPZDRFN/sjQXcWKL2kyIDdEe2WzH2i6FH4XcDfZWVaEvmb4ErFP2+YSDWxNcGnQdI+LibyBtwX0c2Ya4nvj2j2BvEuaVDJG/BlRLcvo/ksopkcBgOK9htmcXk6vikSp4bzA74uKdGyyBvwYoFmTzo2is8jcfbXA9xufpMQ6wyPNRjrJXkDxiVL4FnJ/WzK3P/+dQ3i3JYNMiHZvnoA6yITjuI0yaurayTNx27s19sVZWxDZAwn5r6LNUgHsawoTn3ij5GJ70jdzWiXS65Ar2hnS2yiYH4NG5tN3NUggUPYjlvwEL5ooD1g/m5TN2h3U3SXuRv9LLa3Mul0C18jzGCN5Bdyk2RbrRs9Ryfb4hdJtsUvbGfSXQtMdFtBzDWSK7KQvcXevRjBMx0muRejDeKegZd09ovo7ZshPKr19cIsdjQqPhd7HT4YaAPSRC/BWw2MqOE9rO8g9ojkGNzhgTUgk+wq3IGdeDL9TGJtF2KfI77BORgGlI3kJccrS9aAEJb4IakQqmNy1UHJEJb4UdkQqsPS/4EN2CZ59J7S73wqKioqKioqhot/AedCJIQMIKG9AAAAAElFTkSuQmCC"/></div>
<div class="fluid">The Text</div>
</div>
<div class="parent">
<div class="fixed">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADsUlEQVR4nO3aS4gcVRTG8TsTgjMxCCoYo1ExulCjLjRCGElwISooLgRF1JWjIaIYooIQH5gsghtfIBoiAWeCCLoRxYX4IAjqJkpEXWlAUUQUQWMyMer0z0VVOzVl3X5NV3dPT/2hF9P3u4dzvuqpOvfWDaGioqKioqKiYgDBJjyMLTi13/n0DIzjdfP5BTf0O7eegOcUcxjn9ju/UsEYjkUMgB39zrFUcFaD4uHlfudYKji7iQFT/c6xNHAS3l2SBmAVPmlS/PAZgBFsxm8tFD9cBuBMvNFi4cNjAM7DNP5qs/jFbQBW41nMdFD44jQAo7gWr+H4Agrv2ACsxc162UViPZ7CD10oumMD8Dhm07k17Cyj2DFcjSckz/E/ulx0RwbgskiMG/PCk3E9NmKkSdDVabFbsQcf4fcSC85TaABWYGXuu8lIjEMYq4suxU+ZwTcxgVsla/EX8Da+wtGSimqHqVyRJ0guxHH8g30YT8eubBDnznqAZq3noJE34OkCzXRm/MNInI/rgp9LS7Uc8gZ8U6CpYUM6fkX6dxEXBK23oINC3oADEd2rGc37Ec29QW9vYN0gb8DmiO5PrEg1d0c000G5j6wyyBuwHN9GtFelmosj4wcDjpSRZYn87zGI5yPae9LxZeaaoSzfBwvry/tBkQFbI9rHMppfC8ZngsYbkINIkQEPRrSPZDRFN/sjQXcWKL2kyIDdEe2WzH2i6FH4XcDfZWVaEvmb4ErFP2+YSDWxNcGnQdI+LibyBtwX0c2Ya4nvj2j2BvEuaVDJG/BlRLcvo/ksopkcBgOK9htmcXk6vikSp4bzA74uKdGyyBvwYoFmTzo2is8jcfbXA9xufpMQ6wyPNRjrJXkDxiVL4FnJ/WzK3P/+dQ3i3JYNMiHZvnoA6yITjuI0yaurayTNx27s19sVZWxDZAwn5r6LNUgHsawoTn3ij5GJ70jdzWiXS65Ar2hnS2yiYH4NG5tN3NUggUPYjlvwEL5ooD1g/m5TN2h3U3SXuRv9LLa3Mul0C18jzGCN5Bdyk2RbrRs9Ryfb4hdJtsUvbGfSXQtMdFtBzDWSK7KQvcXevRjBMx0muRejDeKegZd09ovo7ZshPKr19cIsdjQqPhd7HT4YaAPSRC/BWw2MqOE9rO8g9ojkGNzhgTUgk+wq3IGdeDL9TGJtF2KfI77BORgGlI3kJccrS9aAEJb4IakQqmNy1UHJEJb4UdkQqsPS/4EN2CZ59J7S73wqKioqKioqhot/AedCJIQMIKG9AAAAAElFTkSuQmCC"/></div>
<div class="fluid">A longer text. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus magni ipsam facilis laboriosam nesciunt eveniet obcaecati dicta laborum voluptatem reiciendis, possimus vel enim. Dignissimos assumenda ipsa aut. Facere, unde animi.</div>
</div>
.imgBox, .textBox{
float: left;
box-sizing: border-box;
}
.textBox{
height: 70px;
width: 100px;
background-color: grey;
color: white;
text-align: center;
padding-top: 25px;
}
<div>
<div class="imgBox">
<img src="http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" width="100" height="70"/>
</div>
<div class="textBox">
your text
</div>
</div>