How to center an image with a span absolutely overtop that is responsive










0















I've been pulling my hair out trying to make the load in for this responsive as well as look right no matter the screen size.. I've uploaded the site to a random domain I had:



Test Domain



My main problem is that the logo has to be an image rather than actual text and I need the line to be dead centre of the image the whole time regardless of the screen size which then tends to go off centre when the height gets smaller. I tried adding media queries to the line for different screen sizes but it doesn't really work



Edit: Putting code in post as well



HTML:



<!-- Carousel -->

<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel" data-interval="4200" data-pause="false">
<div class="carousel-inner">
<div class="carousel-item black-fade">
<img class="d-block w-100 slide-fade" src="/Images/slide-imagery/Warendorf16_02.jpg" alt="First slide">

</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/AL40028200.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/FUSION-230-x-180-H-67a.jpg" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/mosaic_anniversary_oro_doppia.jpg" alt="Fourth slide">
</div>
</div>
</div>
<div class="title-container">
<span class="title-underline"></span>
<h1 class="test2 load-delay"><img src="/Images/Brooklands-Interiors-logo-noBG-noLine.svg" width="500px" class="BI-loadin"></h1>

</div>
<p class="title-intro">Showroom now open on Oyster Lane, Brooklands</p>
<div class="arrow-down"><a href="#pull-down"><img src="/Images/arrow-dow.svg" width="40px" class="arrow-bounce"></a></div>


CSS:



 /* Title load in styling */

.title-container
position: absolute;
width: 50%;
height: 100%;
text-align: center;
vertical-align: middle;
top: 50%;
display: inline-block;
left: 50%;
transform: translate(-50%, -50%);


.test2
opacity: 0;
animation: example2 4s linear;
z-index: 1000;
padding-top: 42vh;


@keyframes example2
0% padding-top: 47vh;
7% padding-top: 42vh; opacity: 1;
85% padding-top: 42vh; opacity: 1;
100% opacity:0;



.title-underline
background-color: white;
height: 8px;
width: 500px;
display: block;
position: absolute;
transform: scaleX(0);
animation: example3 3s linear;
animation-delay: 1.8s;
z-index: 200;
margin-top: 48vh;
left: 50%;
margin-left: -250px;


.title-underline:after
padding-bottom: 200px;


@keyframes example3
0% transform: scaleX(0);
10% transform: scaleX(1);
11% transform: scaleX(1.05);
12% transform: scaleX(1.035);
13% transform: scaleX(1.025);
14% transform: scaleX(1.01);
85% transform:scaleX(1); opacity: 1;
100% opacity: 0; transform:scaleX(1);


.title-intro
opacity: 0;
color: white;
font-weight: 500;
animation: subtitlefade 4.1s ease-in-out;
font-size: 1.8rem;
top: 50%;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
animation-delay: 5100ms;
letter-spacing: .1rem;
text-align: center;


@keyframes subtitlefade
20% opacity: 0;
30% opacity: 1;
95% opacity: 1;
100% opacity:0;


@keyframes delayedfade
100% opacity: 1;


.load-delay
animation-delay: 1000ms;










share|improve this question
























  • Would it be possible for you to put the code example directly into your question instead of using an external link?

    – Danny
    Nov 13 '18 at 10:37











  • @Danny just added it for you! Think I included everything

    – Grimsted
    Nov 13 '18 at 10:43











  • If you put items in a containing div, then give that container div either and mx-auto or an my-auto bootstrap utility class, it should center the child elements along the x or y-axis respectively.

    – Iskandar Reza Razali
    Nov 15 '18 at 1:16















0















I've been pulling my hair out trying to make the load in for this responsive as well as look right no matter the screen size.. I've uploaded the site to a random domain I had:



Test Domain



My main problem is that the logo has to be an image rather than actual text and I need the line to be dead centre of the image the whole time regardless of the screen size which then tends to go off centre when the height gets smaller. I tried adding media queries to the line for different screen sizes but it doesn't really work



Edit: Putting code in post as well



HTML:



<!-- Carousel -->

<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel" data-interval="4200" data-pause="false">
<div class="carousel-inner">
<div class="carousel-item black-fade">
<img class="d-block w-100 slide-fade" src="/Images/slide-imagery/Warendorf16_02.jpg" alt="First slide">

</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/AL40028200.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/FUSION-230-x-180-H-67a.jpg" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/mosaic_anniversary_oro_doppia.jpg" alt="Fourth slide">
</div>
</div>
</div>
<div class="title-container">
<span class="title-underline"></span>
<h1 class="test2 load-delay"><img src="/Images/Brooklands-Interiors-logo-noBG-noLine.svg" width="500px" class="BI-loadin"></h1>

</div>
<p class="title-intro">Showroom now open on Oyster Lane, Brooklands</p>
<div class="arrow-down"><a href="#pull-down"><img src="/Images/arrow-dow.svg" width="40px" class="arrow-bounce"></a></div>


CSS:



 /* Title load in styling */

.title-container
position: absolute;
width: 50%;
height: 100%;
text-align: center;
vertical-align: middle;
top: 50%;
display: inline-block;
left: 50%;
transform: translate(-50%, -50%);


.test2
opacity: 0;
animation: example2 4s linear;
z-index: 1000;
padding-top: 42vh;


@keyframes example2
0% padding-top: 47vh;
7% padding-top: 42vh; opacity: 1;
85% padding-top: 42vh; opacity: 1;
100% opacity:0;



.title-underline
background-color: white;
height: 8px;
width: 500px;
display: block;
position: absolute;
transform: scaleX(0);
animation: example3 3s linear;
animation-delay: 1.8s;
z-index: 200;
margin-top: 48vh;
left: 50%;
margin-left: -250px;


.title-underline:after
padding-bottom: 200px;


@keyframes example3
0% transform: scaleX(0);
10% transform: scaleX(1);
11% transform: scaleX(1.05);
12% transform: scaleX(1.035);
13% transform: scaleX(1.025);
14% transform: scaleX(1.01);
85% transform:scaleX(1); opacity: 1;
100% opacity: 0; transform:scaleX(1);


.title-intro
opacity: 0;
color: white;
font-weight: 500;
animation: subtitlefade 4.1s ease-in-out;
font-size: 1.8rem;
top: 50%;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
animation-delay: 5100ms;
letter-spacing: .1rem;
text-align: center;


@keyframes subtitlefade
20% opacity: 0;
30% opacity: 1;
95% opacity: 1;
100% opacity:0;


@keyframes delayedfade
100% opacity: 1;


.load-delay
animation-delay: 1000ms;










share|improve this question
























  • Would it be possible for you to put the code example directly into your question instead of using an external link?

    – Danny
    Nov 13 '18 at 10:37











  • @Danny just added it for you! Think I included everything

    – Grimsted
    Nov 13 '18 at 10:43











  • If you put items in a containing div, then give that container div either and mx-auto or an my-auto bootstrap utility class, it should center the child elements along the x or y-axis respectively.

    – Iskandar Reza Razali
    Nov 15 '18 at 1:16













0












0








0








I've been pulling my hair out trying to make the load in for this responsive as well as look right no matter the screen size.. I've uploaded the site to a random domain I had:



Test Domain



My main problem is that the logo has to be an image rather than actual text and I need the line to be dead centre of the image the whole time regardless of the screen size which then tends to go off centre when the height gets smaller. I tried adding media queries to the line for different screen sizes but it doesn't really work



Edit: Putting code in post as well



HTML:



<!-- Carousel -->

<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel" data-interval="4200" data-pause="false">
<div class="carousel-inner">
<div class="carousel-item black-fade">
<img class="d-block w-100 slide-fade" src="/Images/slide-imagery/Warendorf16_02.jpg" alt="First slide">

</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/AL40028200.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/FUSION-230-x-180-H-67a.jpg" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/mosaic_anniversary_oro_doppia.jpg" alt="Fourth slide">
</div>
</div>
</div>
<div class="title-container">
<span class="title-underline"></span>
<h1 class="test2 load-delay"><img src="/Images/Brooklands-Interiors-logo-noBG-noLine.svg" width="500px" class="BI-loadin"></h1>

</div>
<p class="title-intro">Showroom now open on Oyster Lane, Brooklands</p>
<div class="arrow-down"><a href="#pull-down"><img src="/Images/arrow-dow.svg" width="40px" class="arrow-bounce"></a></div>


CSS:



 /* Title load in styling */

.title-container
position: absolute;
width: 50%;
height: 100%;
text-align: center;
vertical-align: middle;
top: 50%;
display: inline-block;
left: 50%;
transform: translate(-50%, -50%);


.test2
opacity: 0;
animation: example2 4s linear;
z-index: 1000;
padding-top: 42vh;


@keyframes example2
0% padding-top: 47vh;
7% padding-top: 42vh; opacity: 1;
85% padding-top: 42vh; opacity: 1;
100% opacity:0;



.title-underline
background-color: white;
height: 8px;
width: 500px;
display: block;
position: absolute;
transform: scaleX(0);
animation: example3 3s linear;
animation-delay: 1.8s;
z-index: 200;
margin-top: 48vh;
left: 50%;
margin-left: -250px;


.title-underline:after
padding-bottom: 200px;


@keyframes example3
0% transform: scaleX(0);
10% transform: scaleX(1);
11% transform: scaleX(1.05);
12% transform: scaleX(1.035);
13% transform: scaleX(1.025);
14% transform: scaleX(1.01);
85% transform:scaleX(1); opacity: 1;
100% opacity: 0; transform:scaleX(1);


.title-intro
opacity: 0;
color: white;
font-weight: 500;
animation: subtitlefade 4.1s ease-in-out;
font-size: 1.8rem;
top: 50%;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
animation-delay: 5100ms;
letter-spacing: .1rem;
text-align: center;


@keyframes subtitlefade
20% opacity: 0;
30% opacity: 1;
95% opacity: 1;
100% opacity:0;


@keyframes delayedfade
100% opacity: 1;


.load-delay
animation-delay: 1000ms;










share|improve this question
















I've been pulling my hair out trying to make the load in for this responsive as well as look right no matter the screen size.. I've uploaded the site to a random domain I had:



Test Domain



My main problem is that the logo has to be an image rather than actual text and I need the line to be dead centre of the image the whole time regardless of the screen size which then tends to go off centre when the height gets smaller. I tried adding media queries to the line for different screen sizes but it doesn't really work



Edit: Putting code in post as well



HTML:



<!-- Carousel -->

<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel" data-interval="4200" data-pause="false">
<div class="carousel-inner">
<div class="carousel-item black-fade">
<img class="d-block w-100 slide-fade" src="/Images/slide-imagery/Warendorf16_02.jpg" alt="First slide">

</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/AL40028200.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/FUSION-230-x-180-H-67a.jpg" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="/Images/slide-imagery/mosaic_anniversary_oro_doppia.jpg" alt="Fourth slide">
</div>
</div>
</div>
<div class="title-container">
<span class="title-underline"></span>
<h1 class="test2 load-delay"><img src="/Images/Brooklands-Interiors-logo-noBG-noLine.svg" width="500px" class="BI-loadin"></h1>

</div>
<p class="title-intro">Showroom now open on Oyster Lane, Brooklands</p>
<div class="arrow-down"><a href="#pull-down"><img src="/Images/arrow-dow.svg" width="40px" class="arrow-bounce"></a></div>


CSS:



 /* Title load in styling */

.title-container
position: absolute;
width: 50%;
height: 100%;
text-align: center;
vertical-align: middle;
top: 50%;
display: inline-block;
left: 50%;
transform: translate(-50%, -50%);


.test2
opacity: 0;
animation: example2 4s linear;
z-index: 1000;
padding-top: 42vh;


@keyframes example2
0% padding-top: 47vh;
7% padding-top: 42vh; opacity: 1;
85% padding-top: 42vh; opacity: 1;
100% opacity:0;



.title-underline
background-color: white;
height: 8px;
width: 500px;
display: block;
position: absolute;
transform: scaleX(0);
animation: example3 3s linear;
animation-delay: 1.8s;
z-index: 200;
margin-top: 48vh;
left: 50%;
margin-left: -250px;


.title-underline:after
padding-bottom: 200px;


@keyframes example3
0% transform: scaleX(0);
10% transform: scaleX(1);
11% transform: scaleX(1.05);
12% transform: scaleX(1.035);
13% transform: scaleX(1.025);
14% transform: scaleX(1.01);
85% transform:scaleX(1); opacity: 1;
100% opacity: 0; transform:scaleX(1);


.title-intro
opacity: 0;
color: white;
font-weight: 500;
animation: subtitlefade 4.1s ease-in-out;
font-size: 1.8rem;
top: 50%;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
animation-delay: 5100ms;
letter-spacing: .1rem;
text-align: center;


@keyframes subtitlefade
20% opacity: 0;
30% opacity: 1;
95% opacity: 1;
100% opacity:0;


@keyframes delayedfade
100% opacity: 1;


.load-delay
animation-delay: 1000ms;







css animation bootstrap-4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 10:42







Grimsted

















asked Nov 13 '18 at 10:22









GrimstedGrimsted

11




11












  • Would it be possible for you to put the code example directly into your question instead of using an external link?

    – Danny
    Nov 13 '18 at 10:37











  • @Danny just added it for you! Think I included everything

    – Grimsted
    Nov 13 '18 at 10:43











  • If you put items in a containing div, then give that container div either and mx-auto or an my-auto bootstrap utility class, it should center the child elements along the x or y-axis respectively.

    – Iskandar Reza Razali
    Nov 15 '18 at 1:16

















  • Would it be possible for you to put the code example directly into your question instead of using an external link?

    – Danny
    Nov 13 '18 at 10:37











  • @Danny just added it for you! Think I included everything

    – Grimsted
    Nov 13 '18 at 10:43











  • If you put items in a containing div, then give that container div either and mx-auto or an my-auto bootstrap utility class, it should center the child elements along the x or y-axis respectively.

    – Iskandar Reza Razali
    Nov 15 '18 at 1:16
















Would it be possible for you to put the code example directly into your question instead of using an external link?

– Danny
Nov 13 '18 at 10:37





Would it be possible for you to put the code example directly into your question instead of using an external link?

– Danny
Nov 13 '18 at 10:37













@Danny just added it for you! Think I included everything

– Grimsted
Nov 13 '18 at 10:43





@Danny just added it for you! Think I included everything

– Grimsted
Nov 13 '18 at 10:43













If you put items in a containing div, then give that container div either and mx-auto or an my-auto bootstrap utility class, it should center the child elements along the x or y-axis respectively.

– Iskandar Reza Razali
Nov 15 '18 at 1:16





If you put items in a containing div, then give that container div either and mx-auto or an my-auto bootstrap utility class, it should center the child elements along the x or y-axis respectively.

– Iskandar Reza Razali
Nov 15 '18 at 1:16












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278800%2fhow-to-center-an-image-with-a-span-absolutely-overtop-that-is-responsive%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278800%2fhow-to-center-an-image-with-a-span-absolutely-overtop-that-is-responsive%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3