Customized strikethrough on title - html

I'm creating a website to school project and i want to put a strikethrough behind my title like in this image. I want that green lines behind text
I am working with HTML and CSS , someone know the code to get that beautiful strikethrough?

Short example including overlaying both strikes should be
p {font-size: 130px; color: #f00;}
span {position: relative;}
span:before, span:after {content: ''; background: rgba(0,0,0,.5); border-radius: 20px; position: absolute; top: calc(50% - 20px); width: 56%; height: 40px; z-index: -1}
span:before {left: 0;}
span:after {right: 0;}
span.left:before {width: 100%;}
span.left:after {width: 100px; left: 0;}
span.longer:before {width: 60%; left: 8%}
span.longer:after {width: 43%; left: 47%;}
<p>
<span>TEXT</span> <br>
<span>WITH</span> <br>
<span>STRIKE</span><br>
<span class="left">LEFT</span>
<span class="longer">OTHER</span>
</p>
Using classes you can make overlays with different widths, etc. The basic idea is obvious.

This is an example , adjust as you wish, but you get the idea.
h2 {
font: 33px sans-serif;
margin-top: 30px;
text-align: center;
text-transform: uppercase;
color: red;
}
h2.background {
position: relative;
z-index: 1;
}
h2.background:before {
border-top: 2px solid #000;
content:"";
margin: 0 auto; /* this centers the line to the full width specified */
position: absolute; /* positioning must be absolute here, and relative positioning must be applied to the parent */
top: 50%; left: 0; right: 0; bottom: 0;
width: 95%;
z-index: -1;
}
<h2 class="background">Random Title</h2>

I did it (Image example) but when i change resolution this happen: not responsive... How can i put it to be responsive? here is my HTML and here is my CSS... Thank you for all resolution but i'm using panther's example
#titulo1{
font-size: 5vw;
font-weight: 400;
color:#f5dc9f;
font-family: 'Moon Light' , sans-serif;
float: right;
margin-bottom: 0;
margin-top: 15vw;
margin-right: 15vw;
display: flex;
}
#titulo2{
color: #f5dc9f;
font-size:6.7vw;
font-family: 'Moon Bold', sans-serif;
clear: right;
float: right;
margin-top: 0;
margin-bottom: 0;
margin-right: 13vw;
}
#titulo3{
font-size: 4.8vw;
font-weight: 400;
color:#f5dc9f;
font-family: 'Moon Light' , sans-serif;
float: right;
margin-top: 0;
margin-right: 3vw;
}
#titulo2:before, #titulo2:after {
content: '';
background: rgba(0,0,255,0.3);;
border-radius: 40px;
position: absolute;
top: calc(53% - 1vw);
width: 50%;
height: 5%;
z-index: -1
}
#titulo2:before{
left: 54vw;
width: 15vw;
}
#titulo2:after{
right: 11vw;
width: 26vw;
}
#titulo1:before, #titulo1:after {
content: '';
background: rgba(0,0,255,0.3);;
border-radius: 40px;
position: absolute;
top: calc(40% - 20px);
width: 50%;
height: 5%;
z-index: -1
}
#titulo1:before{
left: 52vw;
width: 17vw;
height: 2vw;
}
#titulo1:after{
right: 15vw;
width: 20vw;
height: 2vw;
}
#titulo3:before, #titulo3:after {
content: '';
background: rgba(0,0,255,0.3);;
border-radius: 40px;
position: absolute;
top: calc(66% - 20px);
width: 50%;
height: 5%;
z-index: -1
}
#titulo3:before{
width: 3em;
height: 0.4em;
}
#titulo3:after{
right: 0.5em;
width: 9em;
height: 0.4em;
}
<h2 id="titulo1">Aqui vai ser</h2><br>
<h1 id="titulo2">o titulo</h1><br>
<h2 id="titulo3">do nosso trabalho!</h2><br>
here is the snippet but is very diferent from what i see on my browser

Related

How do I remove invisible space around text (Heading)?

So as the title say I put a color on top of an image and I then tried to put some text on top of it, but then all the div got moved to the bottom and the text got moved to the top of the div and when I inspect the heading, it shows a space colored in yellow. I'm trying to understand CSS position and I'm starting to understand it, but right now I don't understand haha. I think it's something with a margin, but I reinitialized it at the beginning of the CSS.
(Also sorry! If you feel the need to tell me that my CSS is bad don't hesitate to tell me off i want to learn from my mistake!)
The HTML
<div id="section3">
<div id="layer">
<h1>Parmi les premiers de classe !</h1>
</div>
</div>
And CSS
#section3 img {
width: 1903px;
margin-left: 0px;
margin-top: -645px;
z-index: 100;
}
#section3 h1 {
margin-top: 260px;
margin-left: 420px;
font-size: 80px;
}
#section3 p {
margin-top: 10px;
margin-left: 590px;
font-size: 30px;
}
.img4{
position: relative;
top: 641px;
}
#section3{
background: url('../Images/CF3.jpg');
position: relative;
bottom:4px;
width: 1903px;
height: 930px;
}
#layer{
background-color: #4c96eb75;
width: 100%;
height: 100%;
}
#layer h1{
display: block;
}
The reset at the start of CSS
* {
margin: 0;
padding: 0;
font-family: Segoe UI;
}
You used up higher values of height and width that's why it happened. I changed that:
#section3 h1 {
/* margin-top: 260px;
margin-left: 420px; */
font-size: 80px;
}
#section3 p {
margin-top: 10px;
margin-left: 590px;
font-size: 30px;
}
.img4{
position: relative;
top: 641px;
}
#section3{
background: url('../Images/CF3.jpg');
position: relative;
bottom:4px;
width: 390px;
height: 300px;
}
#layer{
background-color: #4c96eb75;
width: 100%;
height: 100%;
}
#layer h1{
display: block;
margin: 0;
}
<div id="section3">
<div id="layer">
<h1>Parmi les premiers de classe !</h1>
</div>
</div>
Change the css to this:
#section3 img {
width: 1903px;
margin-left: 0px;
margin-top: -645px;
z-index: 100;
}
#section3 h1 {
/* margin-top: 260px;
margin-left: 420px; */
font-size: 80px;
}
#section3 p {
margin-top: 10px;
margin-left: 590px;
font-size: 30px;
}
.img4{
position: relative;
top: 641px;
}
#section3{
background: url('../Images/CF3.jpg');
position: relative;
bottom:4px;
width: 1903px;
height: 930px;
}
#layer{
background-color: #4c96eb75;
width: 100%;
height: 100%;
}
#layer h1{
display: block;
margin: 0;
}
I have added a margin:0, to the header and removed other styles margin for #section3 h1, that was the reason div was placed at the bottom and

Where to insert overflow:x?

I have a grey background rectangle upon which I've to position elements with position: relative, the rectangle should go out of the page and I'd have to ue overflow-x: hidden, but the problem is that when I use it it messes up all the page. Where should I place overflow-x without messing up all the page? Should I change the HTML?
I tried to place it in main or to wrap the div inside another div use the wrapper for overflow-x, but it still messes up all the page!
body {margin: 0px;
padding: 0px;
font-size: 16px;}
.under-bg_blue-big {float: right;
height: 690px;
width: 690px;
background-image: url(../img/bg-intro-desktop.svg);}
.list {position: relative;
float: right;
color: white;
z-index: 5;
margin-top: 36px;
margin-right: 0px;
padding-left: 0px;}
nav > ul > li {list-style: none;
display: inline;
position: relative;
z-index: 5;}
.under-bg_white-btn {margin-right: 16px;
font-size: 12px;}
.under-bg_green-btn {background-color: #06d89b;
padding: 8px 21px;
border-radius: 5px;
margin-right: 24px;
font-size: 12px;}
.logo {float: left;
width: 180px;
margin-top: 4.58%;
margin-left: 8.19%;
position: relative;
z-index: 1;
margin-bottom: 170px;
clear: both;}
.block-hero {text-align: center;}
.block-hero__hero {float: right;
position: relative;
top: 190px;
right: -50px;}
.section-a {padding-top: 284px;
margin-left: 8.19%;}
.section-a__heading {width: 34.375%;
font-size: 40px;}
.section-a__par {width: 35.28%;}
.section-a__btn {padding: 27px 90px;
background-color: #06d79d;
border: none;
border-radius: 5px;
color: white;}
.under-bg_grey {background-color: #fafafa;
height: 744px;
width: 150%;
margin-top: 30%;
position: relative;
left: -50px;
clip-path: inset(0% 0% 0% 0% round 100px);
font-size: 14px;
z-index: 0;
transform: rotate(15.589deg);
clear: both;}
<main>
<section class="section-a">
<h1 class="section-a__heading">All your files in one secure location, accessible anywhere.</h1>
<p class="section-a__par">Fylo stores all your most important files in one secure location. Access them wherever you need, share and collaborate with friends, family and co-workers.</p>
<button type="button" name="button" class="section-a__btn">Get
Started</button>
</section>
<div class="under-bg_grey"></div>
</main>
If you want the div with the class 'under-bg_grey' as a background for other elements you can change the styles for the particular element as follows.
.under-bg_grey {
background-color: #fafafa;
height: 744px;
width: 150%;
margin-top: -25%;
position: relative;
left: -50px;
clip-path: inset(0% 0% 0% 0% round 100px);
font-size: 14px;
z-index: -1;
transform: rotate(15.589deg);
clear: both;
}
Think so there would not be any need for overflow-x property.
I hope the above provides what you needed :)
add this code..
css
main{
overflow-x:hidden;
}
.under-bg_grey {
background-color: #fafafa;
height: 744px;
width: 100%;
margin-top: 30%;
position: relative;
left: -50px;
clip-path: inset(0% 0% 0% 0% round 100px);
font-size: 14px;
z-index: 0;
transform: rotate(15.589deg);
clear: both;
}
Adding overflow-x: hidden to the main element should do the trick.
As in:
main {
overflow-x: hidden;
}
Here's the working demo:
body {
margin: 0px;
padding: 0px;
font-size: 16px;
}
main {
overflow-x: hidden;
}
.under-bg_blue-big {
float: right;
height: 690px;
width: 690px;
background-image: url(../img/bg-intro-desktop.svg);
}
.list {
position: relative;
float: right;
color: white;
z-index: 5;
margin-top: 36px;
margin-right: 0px;
padding-left: 0px;
}
nav>ul>li {
list-style: none;
display: inline;
position: relative;
z-index: 5;
}
.under-bg_white-btn {
margin-right: 16px;
font-size: 12px;
}
.under-bg_green-btn {
background-color: #06d89b;
padding: 8px 21px;
border-radius: 5px;
margin-right: 24px;
font-size: 12px;
}
.logo {
float: left;
width: 180px;
margin-top: 4.58%;
margin-left: 8.19%;
position: relative;
z-index: 1;
margin-bottom: 170px;
clear: both;
}
.block-hero {
text-align: center;
}
.block-hero__hero {
float: right;
position: relative;
top: 190px;
right: -50px;
}
.section-a {
padding-top: 284px;
margin-left: 8.19%;
}
.section-a__heading {
width: 34.375%;
font-size: 40px;
}
.section-a__par {
width: 35.28%;
}
.section-a__btn {
padding: 27px 90px;
background-color: #06d79d;
border: none;
border-radius: 5px;
color: white;
}
.under-bg_grey {
background-color: #fafafa;
height: 744px;
width: 150%;
margin-top: 30%;
position: relative;
left: -50px;
clip-path: inset(0% 0% 0% 0% round 100px);
font-size: 14px;
z-index: 0;
transform: rotate(15.589deg);
clear: both;
}
<main>
<section class="section-a">
<h1 class="section-a__heading">All your files in one secure location, accessible anywhere.</h1>
<p class="section-a__par">Fylo stores all your most important files in one secure location. Access them wherever you need, share and collaborate with friends, family and co-workers.</p>
<button type="button" name="button" class="section-a__btn">Get
Started</button>
</section>
<div class="under-bg_grey"></div>
</main>
take one div with class name name grey_box and next put your div which has class name under-bg_grey inside it. Take .grey_box div width 100% and overflow-x:hidden. I think this code will help you,
<style>
.grey_box{
width:100%;
overflow-x:hidden;
}
</style>
<body>
<div class="grey_box">
<div class="under-bg_grey"></div>
</div>
</body>

create css hexagon "badge"

I'm trying to create a badge, containing a hexagon with a number in it. The badge/list-item itself would contain some info/name.
this is what I have so far:
.item {
display: block;
background-color: blue;
}
.item > span {
color: white;
display: inline-block;
}
.hexagon {
position: relative;
width: 65px;
height: 65px;
line-height: 65px;
text-align: center;
color: white;
}
.hexagon span {
position: absolute;
color: white;
z-index: 2;
left: 30;
}
.hexagon:before {
color: #ef473a;
position: absolute;
content: "\2B22";
font-size: 65px;
z-index: 1;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
<div class="item">
<div class="hexagon"><span>1</span></div>
<span class="title">TEST test</span> <!-- maximum width? > new line -->
<span class="info">something darkside</span>
</div>
This is what I'm trying to achieve:
As you can see, the "blue" background should only start at the tip of the hexagon. Width and height of it, aren't going to change. So now I'm wondering whether it would be easier to use an image or if someone could help me recreate the image, would be fine too :)
Thanks in advance!
Try the flexbox way, it's made for your case since you have three items (medal, title, description) that you want to have vertically aligned in the middle next to each other.
Below is a starting point, you can probably extend that to your needs by yourself.
Please note that I also changed the way the hexagon is created, it's not using an UTF8 character now but simply colored borders. This gives you more control about the size of the actual hexagon shaped medal.
Standing on one of its tips, the height of this hexagon is equivalent with its diameter (d) which in turn is twice as long as one of the six lines (s) forming the hexagon. The width (w) of this hexagon is then: s * sqrt(3) or .5 * d * sqrt(3).
.badge {
height: 64px;
margin-left: 35px;
color: white;
font-family: sans-serif;
background: blue;
border: 1px solid transparent;
display: flex;
align-item: middle;
}
.medal {
position: relative;
margin-left: -30px;
min-width: 75px;
}
.count {
position: absolute;
width: 58px;
text-align: center;
line-height: 64px;
font-size: 30px;
top: -16.74px;
}
h3 {
max-width: 40%;
margin-right: 30px;
font-size: 14px;
}
p {
font-size: .875em;
}
.hexagon {
position: relative;
width: 58px;
height: 33.49px;
background-color: #ff2600;
margin: 14.74px 0 16.74px 0;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
width: 0;
border-left: 29px solid transparent;
border-right: 29px solid transparent;
}
.hexagon:before {
bottom: 100%;
border-bottom: 16.74px solid #ff2600;
}
.hexagon:after {
top: 100%;
width: 0;
border-top: 16.74px solid #ff2600;
}
<div class="badge">
<div class="medal">
<div class="hexagon">
<div class="count">1</div>
</div>
</div>
<h3>The HEXAGON Badge Quest</h3>
<p>You successfully posted a valid question on Stack Overflow and received an answer.</p>
</div>
Try the following. I haven't tested on mobile. Just chrome at this point, but it should get you close. You'll need to play around with the text somewhat to handle the wrapping and sizing inside the blue bar, but your question was in regards to the badge. The corner effects are clipping the shape by about 10px. So setting a fixed height on the bar and a 10px taller height on the hexagon did the trick. Then just some positioning and margin to move things into position. Good luck.
.item {
display: block;
background-color: blue;
height: 66px;
position: relative;
left: 35px;
width: 100%;
}
.item > span {
color: white;
display: inline-block;
}
.hexagon {
display: inline-block;
position: relative;
width: 66px;
height: 66px;
line-height: 66px;
text-align: center;
color: white;
top: 0;
left: -35px;
}
.hexagon span {
position: absolute;
color: white;
z-index: 2;
width: 66px;
height: 66px;
line-height: 66px;
text-align:center;
left: -0;
}
.hexagon:before {
color: #ef473a;
position: absolute;
content: "\2B22";
font-size: 76px;
z-index: 1;
width: 66px;
height: 66px;
left: 0;
top: -5px;
}
.title {
position: absolute;
font-size: 1.75rem;
top: 12px;
left: 33px;
margin: 0;
text-align:center;
display:block;
height: 66px;
width: 20%;
line-height: 18px;
}
.info {
position: absolute;
top: 0px;
left: 20%;
margin: 0;
text-align:center;
display:block;
height: 66px;
width: 70%;
line-height: 66px;
vertical-align: center;
}
<div class="item">
<div class="hexagon"><span>1</span></div>
<span class="title">TEST test</span> <!-- maximum width? > new line -->
<span class="info">something darkside</span>
</div>

Link/button is going off of the box i made for it

I made a link/button named Friends and when I re-size my window it goes out of the box I made for it. I have tried adding margins and padding but that didn't help me. Every thing I do still makes it go out of the box.
body {
background-color: black;
}
.Forum-Block {
position: absolute;
border-radius: 5%;
left: 10%;
top: 0%;
width: 70%;
height: 140%;
margin: 5%;
background-color: #888888;
border-style: solid;
border-width: medium;
border-color: orange;
}
.Top-Bar {
position: absolute;
top: 8%;
left: 5%;
width: 90%;
height: 6%;
background-color: black;
}
.welcome-msg {
position: absolute;
top: 30%;
left: 2%;
}
.friends-box {
position: relative;
top: 0%;
left: 90%;
width: 10%;
height: 100%;
color: white;
background-color: black;
}
.friends-box:hover {
position: absolute;
top: 0%;
left: 90%;
width: 10%;
height: 100%;
background-color: #262626;
}
try this
.friends-box {
position: relative;
top: 0%;
right:2%;
width: 15%;
height: 100%;
color: white;
font-size:100%;
background-color: black;
}
.friends-box:hover {
background-color: #262626;
}
You should work to a grid as well - make the .welcome-msg{width:75%;left:0;} and the .friend-box{width:25%;right:0}
Wrap the text with tags, Welcome in H1, h2, or h4, and the friends in a p tag maybe and add padding to that instead.
Hope this helps.
I just added floats and removed the position:absolute and position:relative... I also set the height of the Top-Bar to auto so that it takes the height of the content inside. I changed the background colors so you can see what is happening. Hope this helps!
<style type="text/css">
body {
background-color: black;
}
.Forum-Block {
position: absolute;
border-radius: 5%;
left: 10%;
top: 0%;
width: 70%;
height: 140%;
margin: 5%;
background-color: #888888;
border-style: solid;
border-width: medium;
border-color: orange;
}
.Top-Bar {
position: absolute;
top: 8%;
left: 5%;
width: 90%;
height:auto;
background-color: black;
}
.welcome-msg {
float:left;
color: #FFFFFF;
padding:10px;
background: red;
}
.friends-box {
float:right;
color: white;
background-color: green;
padding:10px;
}
.friends-box:hover {
background-color: #262626;
}
</style>
<div class="Forum-Block">
<div class="Top-Bar">
<div class="welcome-msg">Hello, Admin</div>
<div class="friends-box">Friends</div>
</div>
</div>

Css header tags styling

I want to style my header tag H1 as per the following design!
Header Design
The basic css to create is box is easy, how do i create the line after the box i'm using this css for creating the box
h1{
background: #a42f2f;
color: #fff;
width: 179px;
padding: 0px 8px;
}
My Fix for a wordpress Template:
.page_box h1{
background: #a42f2f;
color: #fff;
width: auto;
padding: 5px 11px;
position: relative;
z-index: 2;
font-size: 18px !important;
margin: 9px 0;
display:inline-block;
}
.page_box{
overflow-x:hidden;
}
.page_box h1:after{
content: "";
position: absolute;
height: 2px;
top: 14px;
width: 900px;
background: #ff6300;
margin-left: 11px;
}
I think this fiddle should help you.
h1{
color: #fff;
width: 100%;
padding: 0px 8px;
position: relative;
font-family: sans-serif;
text-transform: uppercase;
}
h1:before {
content: ' ';
width: 178px;
background-color: #a42f2f;
position: absolute;
height: 100%;
z-index: -10;
left: -8px;
}
h1:after {
content: ' ';
border-bottom: 2px solid orange;
display: block;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
z-index: -20;
}