space between 2 words CSS - css

I would like to do a space between 2 words in css for example:
1 RUNNING DAYS ADMIN#SUPER.BIZ
In HTML there is &nbsp but it's not correct to use &nbsp I think?
<div class="bandeau-blanc">
<div class="sous-titre-bandeau-blanc"><i class="far fa-calendar"></i> 1 RUNNING DAYS <i class="far fa-envelope"></i>ADMIN#SUPERBTC.BIZ</div>
</div>
How to do that in CSS ?
.sous-titre-bandeau-blanc{
font-family: 'Open Sans', sans-serif;
font-size: 13.3333px;
color: #474747;
padding-top: 14px;
padding-left: 28px;
padding-bottom: 15px;
}
Thank you

You can wrap your text in a p tag, and you can add a margin to that after making it inline-block.
Alternatively, you can make the container a flexbox, and use justify-content: space-between; but you'll need to group each icon with its respective text inside another div or span.
For example:
<div class="bandeau-blanc">
<div class="sous-titre-bandeau-blanc">
<span>
<i class="far fa-calendar" />
<p>1 RUNNING DAYS</p>
</span>
<span>
<i class="far fa-envelope" />
<p>ADMIN#SUPERBTC.BIZ</p>
</span>
</div>
</div>
<style>
.sous-titre-bandeau-blanc {
display: flex;
justify-content: space-between;
width: 450px;
}
</style>

I would do something like this, if I'm understanding you correctly
<style>
.space-between {
display: inline-block;
padding-left: 3em;
}
.space-between:first-child {
padding-left: 0;
}
</style>
<div class="bandeau-blanc">
<div class="sous-titre-bandeau-blanc">
<div class="space-between"><i class="far fa-calendar"></i> 1 RUNNING DAYS</div>
<div class="space-between"><i class="far fa-envelope"></i>ADMIN#SUPERBTC.BIZ<div>
</div>
</div>

Since you already have a .fa icon in the right part of your div just add it some left margin:
.sous-titre-bandeau-blanc .fa.fa-envelope { margin-left: 30px; }
Also, change your far for fa class to correctly display font-awesome icons

Related

Why div's text and button's text size differ if it both are set to 1em?

Why the button's text size is bigger than div->span's text size when both is set to 1em? How can I make them rendered to the same size?
Now firefox shows me the div's text as 17px high and 20px for the button's text.
.selectDateRangeBtn {
font-size: 1em;
text-align: center;
display: inline;
}
#searchRangeControl {
font-size: 1em;
display: inline;
}
<div id="searchRangeControl" >
<i class="fa fa-calendar"></i> <span>Some text</span> <i class="fa fa-caret-down"></i>
</div>
<button class="selectDateRangeBtn">2019-01-01</button>
The font-size is the same but the button is having a default font-family set by the user agent which is different from your div.
Use the same font-family (reset the font property) and you will have the same text size
.selectDateRangeBtn {
font:initial; /* reset the font */
font-size: 2em;
text-align: center;
display: inline;
}
#searchRangeControl {
font-size: 2em;
display: inline;
}
<div id="searchRangeControl" >
<i class="fa fa-calendar"></i> <span>2019-01-01</span> <i class="fa fa-caret-down"></i>
</div>
<button class="selectDateRangeBtn">2019-01-01</button>

How can I hide code on mouseover in a category title in wordpress?

Either side of a category title I want to display an icon. Here is my code:
<i class="fa fa-tree" style="color: #fcae03;"></i> Christmas Hampers <i class="fa fa-tree" style="color: #fcae03;"></i>
The code works, but how can I make only 'Christmas Hampers' appear on mouseover?
My knowledge of code is limited, would someone mind being quite specific if they can assist me please? Thanks! :)
If I understood you right you want to display only 2 tree icons and on mouseover (hover) to show 'Christmas Hampers'. Then try this code.
If you have some questions leave a comment :)
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> <!-- Probably you don't need to apply this line -->
<div class="christmas-hampers-wrapper">
<i class="fa fa-tree inline-block" style="color: #fcae03;"></i>
<div class="christmas-hampers-wrapper inline-block">
<div class="christmas-hampers">Christmas Hampers</div>
</div>
<i class="fa fa-tree inline-block" style="color: #fcae03;"></i>
</div>
<style>
.inline-block{
position: inherit;
display: inline-block;
}
.christmas-hampers-wrapper > .christmas-hampers-wrapper{
overflow: hidden;
display: inline-block;
width: 0px; height: 18px;
transition: .3s;
}
.christmas-hampers-wrapper > .christmas-hampers-wrapper > .christmas-hampers{
width: 127px;
}
.christmas-hampers-wrapper:hover > .christmas-hampers-wrapper{
display: inline-block;
width: 127px; height: 18px;
}
</style>

CSS: bottom alignment text with material icons

I've been struggling for a correct alignemt between two icons and a small text but I cant manage to properly align them:
I need the text to be align with both icons, can someone give me a help; i've checked a very similar post but I couldn't make it work.
.icon-company-title {
margin-top: 30px;
}
.material-icons.md-18 {
color: $primary;
font-size: 40px;
line-height: 0!important;
}
.material-icons.edit {
color: $primary;
vertical-align: middle;
}
.business-icon {
display: inline-block;
vertical-align: bottom;
}
<div class="icon-company-title">
<div class="business-icon">
<i class="material-icons md-18">business</i>
</div>
<span class="company-card-title">{{ entity.name }}</span>
<button class="" mat-icon-button [matMenuTriggerFor]="menu">
<i class="material-icons edit">mode_edit</i>
</button>
</div>

Flexbox header: Align box right with two elements in rows

Just starting out with Flexbox. Practicing by trying to create a very simple CV website.
Codepen is here:
http://codepen.io/koentj/pen/jyLxGX
I'm trying to get the social-container to the left of the picture-container. Both of these are within the profile-container, while giving name-container most of the space (aka profile-container will use what it needs, and name-container takes the rest).
Whatever I do (and I've tried a bunch), the social-container ends up above the picture-container and I feel like I'm missing something extremely rudimentary.
I'm not entirely sure if your HTML is reflecting what you are trying to do. Currently it's like this:
- header
-- .name-container
-- .profile-container
--- .social-container
---- .picture-container
It would be easier if .picture-container would be a sibling of .social-container rather than a child element.
That way you could use display: flex for .profile-container and would get the two elements side by side.
body {
display: flex;
flex-direction: column;
font-family: "Helvetica Neue, Helvetica, Liberation Sans, Arial, sans-serif";
}
header {
background: #42A8C0;
width: 100%;
color: white;
text-align: center;
}
img {
max-width: 100%;
}
.profile-container {
display: flex;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<header>
<div class="name-container">
<h1>My Name</h1>
<h4>Small summary of current position</h4>
</div>
<div class="profile-container">
<div class="social-container">
<i class="fa fa-linkedin-square" aria-hidden="true"></i>
<i class="fa fa-github-square" aria-hidden="true"></i>
</div>
<div class="picture-container">
<img src="https://cdn.pixabay.com/photo/2016/02/22/18/57/puppy-1216269_960_720.jpg" class="portrait-pic">
</div>
</div>
</header>

Font Awesome's fa-spin spinning around wrong center

I'm using this toggle menu template: http://bootsnipp.com/snippets/featured/navigation-sidebar-with-toggle .
I have replaced bootstraps glyphicon with font awesome's
fa fa-cog fa-spin
but the cog is spinning out of boundaries as if the center is not on the same line as the text. I can see that there is some issue with thesizing, but I cannot figure out where, any idea what am I doing wrong?
JSFiffle: https://jsfiddle.net/vidriduch/mpw2r8h2/1/
You have a problem in the text indent
.sidebar-nav li {
line-height: 40px;
text-indent: 20px; //Remove this rule and use margin
}
And change this class rules
.sub_icon {
float: right;
margin-right: 10px;
margin-top: 10px;
padding-right: 65px; // remove it
padding-top: 10px;// remove it
}
I finally found how to fix it :
You have to align the icon.
<i style='text-align: center;' class='fa fa-cog fa-spin' ></i>
For me it worked to just add 2px padding to the top.
<i className="far fa-lg fa-spin fa-cog" style="padding-top: 2px" />
Inspect the image tag. The CSS padding-right caused all the issues for me.
I solved this using flexbox, had a similar problem.
Just add:
text-align: center;
display:flex;
align-items: center;
justify-content: center;
Also, because your code is aligned to the left, you will have to add margin-right: (pixels); to align it according to your code.
For me, it just needs
display: flex;
align-items: center;
Eg:
<div class="row">
<label class="col-3">Label col</label>
<input class="col-3 form-control" />
<i class="fa fa-spinner fa-spin " style="display: flex; align-items: center;"></i>
</div>
note: I use bootstrap

Resources