There are several approaches to get what you wanted!
- Flexbox:
One of the proper and easiest way to do this is using flexbox by adding
display: flex;
to the parent element of the span and align it using align-items
attribute and its related values such as center
or flex-start
or flex-end
. I just share it with you with the snippet code below (don't be worry I just deleted the inline CSS and add it as a class for better resolution).
.group{
display: flex;
align-items: flex-start;
}
.span{
display:inline-block;
width:65%;
text-align: left;
color:#538232;
font-size: 3.5vw;
}
<hgroup class="group">
<img src="https://sustainablewestonma.000webhostapp.com/wp-content/uploads/2019/08/cropped-45795044_561214090992995_7744636018275385344_n.jpg" class="header-image" width="25%" alt="sustainablewestonma">
<span class="span"> Educate ● Initiate ● Collaborate</span>
</hgroup>
- Absolute Position:
You can also do this with adding
position: absolute;
to the span element like I showed below, and control the vertical position of span by top
attribute, you can set it with percentage or other units like px.
.span{
display:inline-block;
width:65%;
text-align: left;
color:#538232;
font-size: 3.5vw;
position: absolute;
top: 20px;
}
<hgroup>
<img src="https://sustainablewestonma.000webhostapp.com/wp-content/uploads/2019/08/cropped-45795044_561214090992995_7744636018275385344_n.jpg" class="header-image" width="25%" alt="sustainablewestonma">
<span class="span"> Educate ● Initiate ● Collaborate</span>
</hgroup>
NOTE: just note that when you going to use position: absolute;
to avoid other elements get overflowed and suddenly come to your <hgroup>
division you should set a minimum height for your <hgroup>
like your image height.
- Transform: the last approach is to use
transform
attribute with translateY(*value*)
where the value can be any number with the related unit such as px, you can see this also in the code snippet below.
.span{
display:inline-block;
width:65%;
text-align: left;
color:#538232;
font-size: 3.5vw;
transform: translateY(-20px);
}
<hgroup>
<img src="https://sustainablewestonma.000webhostapp.com/wp-content/uploads/2019/08/cropped-45795044_561214090992995_7744636018275385344_n.jpg" class="header-image" width="25%" alt="sustainablewestonma">
<span class="span"> Educate ● Initiate ● Collaborate</span>
</hgroup>