Sara Ree
Sara Ree

Reputation: 3543

place a text between two arrows

I want to place a text inline and between two arrows. at first it seems easy but I can't place everything in their right place:

html, body {
    height: 100%;
}

body {
   background: #fafafc;
    margin: 0;
}

.flex-container {
  height: 100%;
  padding: 0;
  margin: 0;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
}
.grid-container {
  width: 50%;
  display: grid;
  grid-template-columns: 40px auto 40px;
}

.referenceText {
  font-family: Arial;
  display: inline-block;
  font-size: 3vw;
  color: #4287f5;
  /*outline: 0.1vw dashed red;*/
}

.link {
  font-size: 200px;
  color: #a7a4bf;
  text-decoration: none;
  width: 100px;
  height: 100px;
  outline: 0.1vw dashed orange;
}

.link:hover {
  color: #636175;
}
<div class="flex-container">

        <div class="grid-container">
            <a class="link" href="">&#8249;</a>
            <div class="referenceText">This is the reference</div>
            <a class="link" href="">&#8250;</a>
        </div>

    </div>

Please note that we want the arrows to be at the edges of the screen and the text at the center...

Upvotes: 0

Views: 47

Answers (2)

Sayog
Sayog

Reputation: 770

Make these changes in .grid-container and .link

 .grid-container {
  width: 80%;
  display: grid;
  grid-template-columns: 100px auto 100px;
  
  align-items: center;
  justify-items: center;
}
.link {
  
  font-size: 200px;
  color: #a7a4bf;
  text-decoration: none;
  width: 100px;
/*   height: 100px; remove height*/
  outline: 0.1vw dashed orange;
}

check codepen

Upvotes: 1

pistevw
pistevw

Reputation: 432

Add display: flex;, align-items: center; and justify-content: space-between; to .grid-container and change the width to 100%.

Upvotes: 0

Related Questions