I have an h2 header text with the class name "headertekst". I want to center it. I tried to use margin-left: auto, margin-right: auto and width: 100% but nothing happened.
I can give it a margin-left: 20% which will center it but that's just on my laptop. It will not be centered on other screen sizes and on mobile devices.
How do I center it the correct way?
You can just add style in h2 as:
<h2 style="text-align: center;">Text</h2>
h2.headertekst {
text-align: center;
}
<h2 class="headertekst">Test 1</h2>
You can use below css for this
h2 {
width: 100%;
text-align:center;
}
Or
header {
text-align: center;
}
h2 {
display: inline-block;
}
<h2 class="headertekst"> centered text </h2>
.headertekst {
{
text-align: center;
width:100%
}
This is all you need:
.headertekst {
text-align: center;
}
And if you need to center the h2 itself, then just add the text-align: center rule to the parent of the h2 tag.
add style as:
.headertekst{
text-align: center;
}
Here is a workign snippet:
.headertekst{
text-align: center;
}
<h2 class="headertekst">Align this to center</h2>
Ok, the problem is that the last part of your heading is rotating and position absolute. You have to define an approximate average width of the three rotating words.
body {
background: #363636;
}
.headertekst {
color: white;
font-size: 20px;
font-family: "Raleway", Helvetica, Arial, sans-serif;
font-weight: 600;
text-transform: uppercase;
text-align: center;
}
.headertekstrotate {
position: relative;
display: inline-block;
padding: 0 0 0 8px;
width: 150px;
}
.headertekstrotate span {
animation: clock 12s linear infinite 0s;
-ms-animation: clock 12s linear infinite 0s;
-webkit-animation: clock 12s linear infinite 0s;
position: absolute;
left: 0;
top: 0;
opacity: 0;
}
.headertekstrotate span:nth-child(2) {
animation-delay: 4s;
-ms-animation-delay: 4s;
-webkit-animation-delay: 4s;
}
.headertekstrotate span:nth-child(3) {
animation-delay: 8s;
-ms-animation-delay: 8s;
-webkit-animation-delay: 8s;
}
#keyframes clock {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
25% {
opacity: 1;
}
30% {
opacity: 0;
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<h2 class="headertekst">Interlaser is
<div class="headertekstrotate">
<span>professioneel.</span>
<span>voordelig.</span>
<span>betrouwbaar.</span>
</div>
</h2>
Other way:
body {
background: #363636;
}
.headertekst {
color: white;
font-size: 20px;
font-family: "Raleway", Helvetica, Arial, sans-serif;
font-weight: 600;
text-transform: uppercase;
text-align: center;
}
.headertekstrotate {
position: relative;
}
.headertekstrotate span {
animation: clock 12s linear infinite 0s;
-ms-animation: clock 12s linear infinite 0s;
-webkit-animation: clock 12s linear infinite 0s;
position: absolute;
left: 0;
top: 0;
width: 100%;
opacity: 0;
}
.headertekstrotate span:nth-child(2) {
animation-delay: 4s;
-ms-animation-delay: 4s;
-webkit-animation-delay: 4s;
}
.headertekstrotate span:nth-child(3) {
animation-delay: 8s;
-ms-animation-delay: 8s;
-webkit-animation-delay: 8s;
}
#keyframes clock {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
25% {
opacity: 1;
}
30% {
opacity: 0;
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<h2 class="headertekst">
<div class="headertekstrotate">
<span>Interlaser is short.</span>
<span>Interlaser is very very long.</span>
<span>Interlaser is professioneel.</span>
</div>
</h2>
Try to something like this.
.headertekst{
left: 0;
right: 0;
width: 100%;
text-align: center;
}
<h2 class="headertekst">This is Heading</h2>
try this
.headertekst
{
text-align:center;
width:100%;
}
.headertekst
{
text-align:center;
width:100%;
}
<h2 class="headertekst">This is center text</h2>
Simply change the Css properties to this:
.headertekst {
width: 100%
display: inline-block;
overflow: hidden;
text-align: center;
}
Reason: Sometimes text-align does not works if there is no width set. And overflow should always be kept hidden in these cases. display: inline-block As its name says: it displays the element in a line in a block. And finally, text-align: center it aligns the text to center.
Related
I am looking for answers to the following 2 questions.
I want the background to change with a medium slow transition after the welcome animation ends, but the background changes as soon as the code runs. In addition, the welcome text cannot be placed in the middle of the page. (If you have a better idea for the background image,
cool ideas, I'd love to get some help.)
In my last question there seems to be no space between the letter W and the border How can I increase this space? I want to have only html and css while doing these.
Before:
After:
body {
margin: 0;
padding: 0;
background: black;
}
section {
height: 100vh;
background: #000;
}
h1 {
margin: 0px;
padding: 0px;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
color: #ddd;
font-size: 6em;
font-family: sans-serif;
}
h1:after {
content: url('https://images.wallpaperscraft.com/image/single/space_stars_constellation_162862_1920x1080.jpg');
transition: background 5s ease-in-out
}
h1 span {
display: inline-block;
animation: animate 1s linear forwards;
border:2px solid black;
}
#keyframes animate {
0% {
opacity: 0;
}
100% {
opacity: 1;
color: red;
background-color: white;
border: 2px solid red;
border-radius: 4px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black
}
}
h1 span:nth-child(1) {
animation-delay: 1.5s;
}
h1 span:nth-child(2) {
animation-delay: 2.5s;
}
h1 span:nth-child(3) {
animation-delay: 3.5s;
}
h1 span:nth-child(4) {
animation-delay: 4.5s;
}
h1 span:nth-child(5) {
animation-delay: 5.5s;
}
h1 span:nth-child(6) {
animation-delay: 6.5s;
}
h1 span:nth-child(7) {
animation-delay: 7.5s;
}
<section>
<h1>
<span>W</span>
<span>E</span>
<span>L</span>
<span>C</span>
<span>O</span>
<span>M</span>
<span>E</span>
</h1>
</section>
You can probably forget the idea of placing the words exactly in the galaxy, because you will never know the resolution of the person that's looking at your page.
I did some minor changes:
Addded an animation to your ::before element to fade in the background.
Moved the CSS properties from the animation to the span selector, and just left the properties that actually changed.
Added a padding to the span elements so it was more readable.
Added a size to the span elements that depends on the screen size, so you don't end up with gigantic letter on a mobile unit.
Centered the h1 with flex properties, instead of absolute, so you can easily move the h1 element around with transform: translate.
If you already have a set CSS value on the element, you only need to tell what the animation should animate towards, hence you don't need to set up 0% in the keyframe.
body {
margin: 0;
padding: 0;
background: #000;
}
section {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
position: relative;
}
section::before {
position: absolute;
content: '';
inset: 0;
background: url('https://images.wallpaperscraft.com/image/single/space_stars_constellation_162862_1920x1080.jpg');
background-size: cover;
background-position: center;
opacity: 0;
animation: fadeInBackground 1s linear 8.5s forwards;
}
h1 {
margin: 0px;
padding: 0px;
color: #ddd;
font-size: min(6vw, 6rem);
font-family: sans-serif;
}
h1 span {
display: inline-block;
color: red;
padding: 0.25rem;
padding-bottom: 0;
background-color: white;
border: 2px solid black;
border-radius: 4px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
opacity: 0;
box-sizing: border-box;
animation: letterAnimation 1s linear forwards;
}
#keyframes fadeInBackground {
100% {
opacity: 1;
}
}
#keyframes letterAnimation {
100% {
opacity: 1;
border-color: red;
}
}
h1 span:nth-child(1) {
animation-delay: 1.5s;
}
h1 span:nth-child(2) {
animation-delay: 2.5s;
}
h1 span:nth-child(3) {
animation-delay: 3.5s;
}
h1 span:nth-child(4) {
animation-delay: 4.5s;
}
h1 span:nth-child(5) {
animation-delay: 5.5s;
}
h1 span:nth-child(6) {
animation-delay: 6.5s;
}
h1 span:nth-child(7) {
animation-delay: 7.5s;
}
<section>
<h1>
<span>W</span>
<span>E</span>
<span>L</span>
<span>C</span>
<span>O</span>
<span>M</span>
<span>E</span>
</h1>
</section>
I think for you first issue was from using h1:after and it just set photo after each h1 and there wont be any place to show words
I used different div for showing background and add opacity propery to fade in in animation
and for you second issue you can use margin to increse the distance
here is what I did :
body {
margin: 0;
padding: 0;
background: black;
}
section {
height: 100vh;
background: #000;
}
h1 {
margin: 0px;
padding: 0px;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
color: #ddd;
font-size: 6em;
font-family: sans-serif;
}
.galaxy{
position:absolute;
width:100%;
height:100%;
background: url("https://images.wallpaperscraft.com/image/single/space_stars_constellation_162862_1920x1080.jpg");
opacity: 0;
animation: backgroundAnimation 1s linear forwards;
animation-delay: 8s;
}
h1 span {
display: inline-block;
animation: animate 1s linear forwards;
border: 2px solid black;
margin:0px 10px;
}
#keyframes backgroundAnimation {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes animate {
0% {
opacity: 0;
}
100% {
opacity: 1;
color: red;
background-color: white;
border: 2px solid red;
border-radius: 4px;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
}
h1 span:nth-child(1) {
animation-delay: 1.5s;
}
h1 span:nth-child(2) {
animation-delay: 2.5s;
}
h1 span:nth-child(3) {
animation-delay: 3.5s;
}
h1 span:nth-child(4) {
animation-delay: 4.5s;
}
h1 span:nth-child(5) {
animation-delay: 5.5s;
}
h1 span:nth-child(6) {
animation-delay: 6.5s;
}
h1 span:nth-child(7) {
animation-delay: 7.5s;
}
<section>
<div class="galaxy"></div>
<h1>
<span>W</span>
<span>E</span>
<span>L</span>
<span>C</span>
<span>O</span>
<span>M</span>
<span>E</span>
</h1>
</section>
I am making a website, where I want a slideshow on one on the pages. However, since the slideshow takes up the whole page, my header and menu places itself underneath it. I tried making a div with a link where you can press "go back", to return to the index page, but it is not possible to click the link, and it is only visible when the slideshow changes from one image to another. The z-index on the slideshow is 1, and I tried making it 2, and the "button" 1, and vice versa. Still, I cannot come up with a solution. I really hope someone will be able to help with this. Thanks in advance.
I'm not posting any code, but if that is preferred, just ask!
CSS
.h1 { font-family:GeosansLight, Verdana, sans-serif; color: #fff; font-size: 40pt; }
.m1 { font-family:GeosansLight, Verdana, sans-serif; color: #fff; font-size: 18pt; }
.m2 { font-family:GeosansLight, Verdana, sans-serif; color: #fff; font-size: 15pt; }
.m3 { font-family:GeosansLight, Verdana, sans-serif; color: #fff; font-size: 30pt; }
body {
width: 100%;
height: 100%;
overflow: hidden;
}
.index-bg {
background-image: url(bild/1.png);
}
.kontakt-bg {
background-image: url(bild/2.png);
}
.porto-bg {
background-color: none;
}
#header {
height: 40px;
width: 100%;
text-align: center;
position: center;
}
#menu {
height: 20px;
width: 100%;
text-align: center;
}
ul.menli {
list-style-type: none;
}
ul.menli li {
display: inline-block;
margin: 0px 50px;
}
ul.menli li a {
text-decoration: none;
color: #fff;
}
ul.menli li a:hover {
text-decoration: underline;
}
#main-left {
height: 500px;
width: 50%;
float: left;
margin-top: 100px;
margin-left: 395px;
background-color: none;
}
ul.mainli {
list-style-type: none;
}
ul.mainli li{
margin-top: 10px;
}
ul.mainli li a {
color: #fff;
}
#main-right {
height: 500px;
width: 50%;
float: right;
margin-top: 10px;
background-color: none;
margin-top: 10px;
}
The button I added
#button {
float: right;
padding-right: 60px;
z-index: 2;
}
a {
color: pink;
}
Slideshow:
.slideshow {
list-style: none;
z-index: 1;
}
.slideshow li span {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
color: transparent;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
opacity: 0;
z-index: 0;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-animation: imageAnimation 24s linear infinite 0s;
-moz-animation: imageAnimation 24s linear infinite 0s;
animation: imageAnimation 24s linear infinite 0s;
}
.no-cssanimations .slideshow li span {
opacity: 1;
}
#-webkit-keyframes
imageAnimation {
0%
{
opacity: 0;
-webkit-animation-timing-function: ease-in;
}
12.5% {
opacity: 1;
-webkit-animation-timing-function: ease-out;
}
25% {
opacity: 1;
}
37.5% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-moz-keyframes
imageAnimation {
0% {
opacity: 0;
-moz-animation-timing-function: ease-in;
}
12.5% {
opacity: 1;
-moz-animation-timing-function: ease-out;
}
25% {
opacity: 1;
}
37.5% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes
imageAnimation {
0% {
opacity: 0;
-webkit-animation-timing-function: ease-in;
-moz-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
12.5% {
opacity: 1;
-webkit-animation-timing-function: ease-out;
-moz-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
25% {
opacity: 1;
}
37.5% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-webkit-keyframes
titleAnimation {
0% {
opacity: 0;
}
12.5% {
opacity: 1;
}
25% {
opacity: 1;
}
37.5% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-moz-keyframes
titleAnimation {
0% {
opacity: 0;
}
12.5% {
opacity: 1;
}
25% {
opacity: 1;
}
37.5% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes
titleAnimation {
0% {
opacity: 0;
}
12.5% {
opacity: 1;
}
25% {
opacity: 1;
}
37.5% {
opacity: 0;
}
100% {
opacity: 0;
}
}
.slideshow li:nth-child(1) span { background-image: url(bild/1.png); }
.slideshow li:nth-child(2) span {
background-image: url(bild/2.png);
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
animation-delay: 6s;
}
.slideshow li:nth-child(3) span {
background-image: url(bild/3.png);
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
animation-delay: 12s;
}
.slideshow li:nth-child(4) span {
background-image: url(bild/1.png);
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
animation-delay: 18s;
}
HTML on the page in question
<!DOCTYPE html>
<html class="porto-bg">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
</script>
</head>
<body>
<div id="header" class="h1">
MUA: CAROLINE MIKKELSEN</div>
<div id="menu" class="m1">
<ul class="menli">
<li> forside </li>
<li> portofølje </li>
<li> samarbeidspartnere </li>
<li> kontakt </li>
</ul>
</div>
<ul class="slideshow">
<li> <span>Slide one</span> </li>
<li> <span>Slide two</span> </li>
<li> <span>Slide three</span> </li>
<li> <span>Slide four</span> </li>
</ul>
<div id="button" class="m3">
GO BACK
</div>
</body>
</html>
The carousel images might also been given z-index individually.
Please make your z-index = number of slides + 2 (container and one extra) and try
I think a correct use of positioning would solve your problem ...
whenever I have a problem of this sort I always refer to W3Schools website
as they have a very diverse set of info on everything ...
W3Schools - CSS position Property
furthermore I find it easier to wrap elements like lists in a container div
<div class="container">
<ul class="slideshow">
<li> <span>Slide one</span> </li>
<li> <span>Slide two</span> </li>
<li> <span>Slide three</span> </li>
<li> <span>Slide four</span> </li>
</ul>
</div>
just so they will be easier to manipulate on the larger scheme of things ....
I also noticed that you repeat some code that you can group to save a few lines like so :
.m1 .m2 .m3{
font-family: GeosansLight, Verdana, sans-serif;
color: #fff;
}
I'm trying to make a background image slideshow for my photography portfolio.
When each image fades in, I want it to link to its respective gallery.
I also have a text box that fades with the images. I would like to also link to the respective gallery. I have not added the code in for that yet as I do not know how without ruining all the code linked to the .
At the moment, no matter where I seem to put the links, they overlap and the bottom (link3) is only clickable.
My HTML:
<ul class="cb-slideshow">
<li>
<span><a id="gallerylink" href="link1"></a></span>
<div>
<h3>Fire & Light</h3>
</div>
</li>
<li>
<span><a id="gallerylink" href="link2"></a></span>
<div>
<h3>Live Music</h3>
</div>
</li>
<li>
<span><a id="gallerylink" href="link3"></a></span>
<div>
<h3>Water & Nature</h3>
</div>
</li>
</ul>
My CSS:
#gallerylink {
position: absolute;
display: block;
width: 100%;
height: 100%;
background-color: transparent;
z-index: 999;
}
.cb-slideshow,
.cb-slideshow:after {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 0;
list-style-type: none;
}
.cb-slideshow li span {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
color: transparent;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
opacity: 0;
z-index: 0;
animation: imageAnimation 18s linear infinite 0s;
}
.cb-slideshow li div {
z-index: 1000;
position: absolute;
bottom: 5%;
right:5%;
width: 10%;
text-align: center;
opacity: 0;
color: #fff;
animation: titleAnimation 18s linear infinite 0s;
}
.cb-slideshow li div h3 {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 25px;
font-weight: 400;
letter-spacing: 2px;
padding: 0;
background-color: white;
line-height: 45px;
}
.cb-slideshow li:nth-child(1) span {
background-image: url(iamge1)
}
.cb-slideshow li:nth-child(2) span {
background-image: url(image2);
animation-delay: 6s;
}
.cb-slideshow li:nth-child(3) span {
background-image: url(image3);
animation-delay: 12s;
}
.cb-slideshow li:nth-child(2) div {
animation-delay: 6s;
}
.cb-slideshow li:nth-child(3) div {
animation-delay: 12s;
}
#keyframes imageAnimation {
0% { opacity: 0; animation-timing-function: ease-in; }
5% { opacity: 1; animation-timing-function: ease-out; }
30% { opacity: 1 }
35% { opacity: 0 }
100% { opacity: 0 }
}
#keyframes titleAnimation {
0% { opacity: 0 }
5% { opacity: 1 }
30% { opacity: 1 }
33% { opacity: 0 }
100% { opacity: 0 }
}
#media screen and (max-width: 1140px) {
.cb-slideshow li div h3 { font-size: 20px }
}
#media screen and (max-width: 600px) {
.cb-slideshow li div h3 { font-size: 14px }
}
FYI I'm not taking credit for most of this code; its from: http://tympanus.net/codrops/2012/01/02/fullscreen-background-image-slideshow-with-css3/
I realise the background-image and a href 's are not real links. I removed them so it would allow me to post this question with low reputation.
Here is the page in question if that helps: http://kalemhornphoto.format.com/
This particular site runs off Format, which takes care of my site theme (and code) hosting and backend, though my CSS and HTML overrides theirs.
Thanks in advance!
jQuery is one way:
// Go trough every li with #gallerylink inside
$("li #gallerylink").each(function()
{
// Bind click event to it
$(this).parent().on("click", function()
{
// Click the link if the li is clicked
$(this).find("#gallerylink")[0].click();
});
});
I have some misbehaving text in a CSS animation.
The text appears to "type" itself out, and then end with a blinking cursor. It does this well, but when it's done typing a line that line tends to "float" or "shift" itself over to the center of the page.
I am centering the text with text-align: center; as well as with a flexbox (to get it center of the page).
Here's a link to a JSFiddle
And here's some code:
html, body {
height: 100%;
width: 100%;
}
body {
overflow-x: hidden;
overflow-y: hidden;
}
.do-you-even-flexbox, .content {
position:relative;
top:0;
width:100%;
height:100%;
}
.content {
padding:8px 20px 15px;
display:flex;
align-content:center;
}
.box {
height:20%;
margin:auto
}
h1 {
text-align: center;
font-size: 75px;
margin-top: 0em;
margin-bottom: 0em;
padding: 0em;
}
h2 {
font-size: 50px;
text-align: center;
margin-top: 0em;
margin-bottom: 0em;
padding: 0em;
}
h3 {
font-size: 25px;
text-align: center;
margin-top: 0em;
margin-bottom: 0em;
padding: 0em;
}
a {
color: #000;
text-decoration: none;
}
.content h1 {
white-space:nowrap;
overflow:hidden;
-webkit-animation: typing 5s steps(60, end);
-moz-animation: typing 5s steps(60, end);
}
.content h2 {
white-space:nowrap;
overflow:hidden;
-webkit-animation: typing 5s steps(60, end);
-webkit-animation-delay: 4s;
-webkit-animation-fill-mode:both;
-moz-animation: typing 5s steps(60, end);
-moz-animation-delay:4s;
-moz-animation-fill-mode:both;
}
.content h3 {
white-space: nowrap;
overflow: hidden;
-webkit-animation: typing 10s steps(120, end);
-webkit-animation-delay: 8s;
-webkit-animation-fill-mode: both;
-moz-animation: typing 10s steps(120, end);
-moz-animation-delay: 8s;
-moz-animation-fill-mode: both;
}
span {
-webkit-animation: blink 1s infinite;
-moz-animation: blink 1s infinite;
}
#-webkit-keyframes typing {
from { width: 0; }
to { width: 100%; }
}
#-webkit-keyframes blink {
to { opacity: .0;}
}
#-moz-keyframes typing {
from { width: 0; }
to { width: 100%; }
}
#-moz-keyframes blink {
to { opacity: .0; }
}
And here's some HTML that goes with it:
<i class="do-you-even-flexbox"></i>
<div class="content">
<div class="box">
<h1>This wasn't the same as the fiddle code.</p>
<h2>So I've removed some details so it's similar to the fiddle.</p>
<h3>~ get in touch ~ about me ~ blog ~ projects ~ my portfolio ~<span> |</span></h3>
</div>
</div>
well, the problem seems to be with the animation from 0 to 100%, since Heading tags are blocks, and blocks always are 100% percent from its container, the animation actually goes from 0 to the total width of the page. What you are trying to do here its a little bit tricky but can be done nesting a tag inside every Heading tag and animating that tag while giving each heading tag inline behavior which ensures the width is not 100% of the container but just the text.
html, body {
height: 100%;
width: 100%;
}
body {
overflow-x: hidden;
overflow-y: hidden;
}
.do-you-even-flexbox, .content {
position:relative;
top:0;
width:100%;
height:100%;
}
.content {
padding:8px 20px 15px;
display:flex;
align-content:center;
}
.box {
height:20%;
margin:auto
text-align: center;
}
h1, h2, h3 {
display: inline-block;
position: relative;
background-color: #cccccc;
}
h1 span {
font-size: 75px;
margin: 0;
padding: 0em;
display: block;
background-color: #ff0000;
}
h2 span {
font-size: 50px;
text-align: center;
margin-top: 0em;
margin-bottom: 0em;
padding: 0em;
}
h3 span {
font-size: 25px;
text-align: center;
margin-top: 0em;
margin-bottom: 0em;
padding: 0em;
}
a {
color: #000;
text-decoration: none;
}
.content h1 span {
white-space:nowrap;
overflow:hidden;
-webkit-animation: typing 2s steps(60, end);
-moz-animation: typing 2s steps(60, end);
}
.content h2 {
white-space:nowrap;
overflow:hidden;
-webkit-animation: typing 2s steps(60, end);
-webkit-animation-delay: 2s;
-webkit-animation-fill-mode:both;
-moz-animation: typing 2s steps(60, end);
-moz-animation-delay:2s;
-moz-animation-fill-mode:both;
}
.content h3 {
white-space: nowrap;
overflow: hidden;
-webkit-animation: typing 10s steps(120, end);
-webkit-animation-delay: 2s;
-webkit-animation-fill-mode: both;
-moz-animation: typing 2s steps(120, end);
-moz-animation-delay: 2s;
-moz-animation-fill-mode: both;
}
span.caret {
-webkit-animation: blink 1s infinite;
-moz-animation: blink 1s infinite;
}
#-webkit-keyframes typing {
from { width: 0; }
to { width: 100%; }
}
#-webkit-keyframes blink {
to { opacity: .0;}
}
#-moz-keyframes typing {
from { width: 0; }
to { width: 100%; }
}
#-moz-keyframes blink {
to { opacity: .0; }
}
<i class="do-you-even-flexbox"></i>
<div class="content">
<div class="box">
<h1><span>This</span></h1>
<br>
<h2><span>This is a subtitile</span></h2>
<br>
<h3><span>These are links to things on other pages.<span class="caret">|</span> </span></h3>
</div>
</div>
I want to make center this Miss, hug...
This is my site: https://www.ajdinalic.cf/
Image: http://prntscr.com/69oewr
I am still new at this coding, and found this code on google
This is on weebly btw, i tried to fix but i dont know and i dont want to make it worse
.rw-wrapper{
width: 80%;
position: relative;
margin: 110px auto 0 auto;
font-family: 'Bree Serif';
padding: 10px;
}
.rw-sentence{
margin: 0;
text-align: center;
text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
}
.rw-sentence span{
color: #444;
white-space: initial;
font-size: 200%;
font-weight: normal;
}
.rw-words{
display: inline;
}
.rw-words span{
position: absolute;
opacity: 0;
overflow: hidden;
width: 100%;
color: #6b969d;
text-align: center;
}
.rw-words-1 span{
animation: rotateWordsFirst 18s linear infinite 0s;
text-align: center;
}
.rw-words-2 span{
animation: rotateWordsSecond 18s linear infinite 0s;
}
.rw-words span:nth-child(2) {
animation-delay: 3s;
color: #6b889d;
}
.rw-words span:nth-child(3) {
animation-delay: 6s;
color: #6b739d;
}
.rw-words span:nth-child(4) {
animation-delay: 9s;
color: #7a6b9d;
}
.rw-words span:nth-child(5) {
animation-delay: 12s;
color: #8d6b9d;
}
.rw-words span:nth-child(6) {
animation-delay: 15s;
color: #9b6b9d;
}
#keyframes rotateWordsFirst {
0% { opacity: 1; animation-timing-function: ease-in; height: 0px; }
8% { opacity: 1; height: 60px; }
19% { opacity: 1; height: 60px; }
25% { opacity: 0; height: 60px; }
100% { opacity: 0; }
}
#keyframes rotateWordsSecond {
0% { opacity: 1; animation-timing-function: ease-in; width: 0px; }
10% { opacity: 0.3; width: 0px; }
20% { opacity: 1; width: 100%; }
27% { opacity: 0; width: 100%; }
100% { opacity: 0; }
}
<!DOCTYPE html>
<html>
<head></head>
<section class="rw-wrapper">
<h2 class="rw-sentence">
<span>I</span>
<br>
<div class="rw-words rw-words-1">
<span>Miss</span>
<span>Want to hug</span>
<span>Want to kiss</span>
<span>Need</span>
<span>Want to see</span>
<span>Want to be with</span>
</div><br>
<span>You</span>
</h2>
</section>
<body class=' wsite-theme-light'>
<div style='display:none'>{title}</div>
<div style='display:none'>{menu}</div>
<div style='display:none'>{content}</div>
<div style='display:none'>{content}>{footer}</div>
</body>
</html>
Add top: 75px; left: 0; right: 0; to .rw-words span.
Let me know if this helps.