Div is smaller than the content of the Div - html

I've a DIV, with a button inside. Under this DIV, I've a hr, but the hr isn't under the button. I could make the DIV height bigger, but I don't know how high the button is (it depends on the browser). Can I style the DIV, that all things, which are in the code under the DIV, on the website also under the DIV are? I show below my HTML and the CSS code, and a screenshot from the result.
body {
min-height: 100vh;
}
/* centering the div that is supposed to take all content */
#center {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
#wrapper {
background: rgba(255, 255, 255, 0.1);
border-radius: 50px;
box-shadow: -1px 0px 20px 0px rgba(0, 0, 0, 1);
height: 75vh;
padding: 50px;
width: 75vh;
}
hr {
border-style: none;
border-top: 1px solid black;
}
#output {
display: inline-block;
}
/* make button sit on the right side */
#copy {
float: right;
}
<div id="center">
<div id="wrapper">
<div id="top">
<div id="output"></div>
<div id="copy"><button>kopieren</button></div>
</div>
<hr>
</div>
</div>

Is your problem that you want the hr to be placed under the button? Then, applying a width: 100% to it could be a solution. But it depends on the final result you're looking for.
* {
font-family: sans-serif;
color: white;
}
/* Schriftart (Sansserif), Weiss */
body {
background-image: url(img.jpg);
background-position: center;
background-size: cover;
min-height: 100vh;
}
/* positioning background image */
#center {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
/* centering the div that is supposed to take all content */
#wrapper {
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.1);
border-radius: 50px;
box-shadow: -1px 0px 20px 0px rgba(0, 0, 0, 1);
height: 75vh;
padding: 50px;
width: 75vh;
}
hr {
border-style: none;
border-top: 1px solid black;
width: 100%;
}
#output {
display: inline-block;
}
#copy {
float: right;
}
/* make button sit on the right side */
button {
background-color: rgb(132, 60, 116);
border: none;
padding: 8px;
border-radius: 10px;
}
<div id="center">
<div id="wrapper">
<div id="top">
<div id="output"></div>
<div id="copy"><button>kopieren</button></div>
</div>
<hr>
</div>
</div>

Just add
#top {
display: flex;
flex-direction: column;
}
Here is the result
* {
font-family: sans-serif;
color: white;
}
/* Schriftart (Sansserif), Weiss */
body {
background-image: url(img.jpg);
background-position: center;
background-size: cover;
min-height: 100vh;
}
/* positioning background image */
#center {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
/* centering the div that is supposed to take all content */
#wrapper {
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.1);
border-radius: 50px;
box-shadow: -1px 0px 20px 0px rgba(0, 0, 0, 1);
height: 75vh;
padding: 50px;
width: 75vh;
}
hr {
border-style: none;
border-top: 1px solid black;
}
#output {
display: inline-block;
}
#copy {
float: right;
}
/* make button sit on the right side */
button {
background-color: rgb(132, 60, 116);
border: none;
padding: 8px;
border-radius: 10px;
}
#top {
display: flex;
flex-direction: column;
}
<div id="center">
<div id="wrapper">
<div id="top">
<div id="output"></div>
<div id="copy"><button>kopieren</button></div>
</div>
<hr>
</div>
</div>

Related

CSS placement: Horizontal and vertical placement of a text and a button

I'm struggling with a CSS placement problem.
For a project I use clipboard.js to copy the content of a p tag.
In a div, I have my text on the left and a button on the right with an icon to copy the text. The size of the text is dynamic and I cut the text if it exceeds the length of the div.
I'm looking for a :
1 - Align the text vertically (on several lines if the text is too long)
2 - Put the button on the right with a margin on the left.
3 - center the button vertically
I managed to put the text and the button on one line with the display: inline-block property but both the button and the text are not vertically centered.
Here is my code: https://jsfiddle.net/n70jrymp/
See if this is what you looking for, i changed the display: inline-block for flex and centered the content.
#container {
width: 80% !important;
margin-left: 10%;
}
#result{
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.resultItem {
display: flex;
border: 1px solid black;
background: white;
max-width: 100%;
width: 100%;
color: black;
line-height: 100%;
align-items: center;
justify-content: center;
}
.resultItem>p {
display: inline-block;
width: calc(100% - 60px);
overflow-wrap: anywhere;
margin: 0;
}
.resultItem>.clippy {
display: inline-block;
margin-bottom: 0;
width: 40px;
height: 40px;
cursor: pointer;
background-color: #fff;
background-image: url("https://abs.twimg.com/emoji/v1/72x72/1f4cb.png");
/* Twitter clipboard emoji */
background-size: 60% auto;
background-position: center center;
background-repeat: no-repeat;
border: 1px solid rgba(0, 0, 0, 0.29);
border-bottom-color: rgba(0, 0, 0, 0.36);
border-radius: 3px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}
.clippy:before {
content: '';
display: none;
position: absolute;
z-index: 9998;
top: 35px;
left: 15px;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid rgba(0, 0, 0, 0.72);
}
.clippy:after {
content: 'Copy to Clipboard';
display: none;
position: absolute;
z-index: 9999;
top: 40px;
left: -37px;
width: 124px;
height: 36px;
color: #fff;
font-size: 10px;
line-height: 36px;
text-align: center;
background: rgba(0, 0, 0, 0.72);
border-radius: 3px;
}
.clippy:hover {
background-color: #eee;
}
.clippy:hover:before,
.clippy:hover:after {
display: block;
}
.clippy:active,
.clippy:focus {
outline: none;
}
.clippy:active:after,
.clippy:focus:after {
content: 'Copied!';
}
<link rel="stylesheet" href="test.css">
<link rel="stylesheet" href="https://unpkg.com/mustard-ui#latest/dist/css/mustard-ui.min.css">
<div id="container">
<div id="result">
<div class="resultItem" id="test">
<p>My wonderful strzfddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddstrzfddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddstrzfddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddstrzfddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddstrzfddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddstrzfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</p>
<button class="clippy" data-clipboard-target="#test"></button>
</div>
</div>
</div>

Circle with transparent borders over background

How can I achieve such a thing in CSS?
I've tried so many ways but the dark background is still in the way and can't be clipped so the background image under it's invisible...
.item {
position: relative;
}
.item:before {
content: '';
size(100%);
top: 0;
left: 0;
z-index: 1;
background: rgba(0, 0, 0,0 0.1);
}
<div class="item">
<img>
<span class="rate">
<span class="amount">10</span> امتیاز
</span>
</div>
I'm looking for a way to be able to make parts of the dark background transparent, so the image can be seen.
This can be achieved using a radial gradient, (Example split onto separate lines to make it easier to read)
background-image: radial-gradient(
/* Position the circle at the center, 40px from the top */
circle at center 40px,
/* The center of the radius should be dark */
rgba(0,0,0,0.4) 0%,
/* This is the inner edge of the circle, we transition from dark-transparent between pixels 30 and 31 */
rgba(0,0,0,0.4) 30px, rgba(0,0,0,0) 31px,
/* This is the outer edge of the circle, we transition back from transprent-dark between pixels 34 and 35*/
rgba(0,0,0,0) 34px, rgba(0,0,0,0.4) 35px,
/* Everything outside of the circle should be dark */
rgba(0,0,0,0.4) 100%
);
Where circle at center 40px defines the position of the circle relative to the parent element (Horizontally centred, an 40px down from the top) bare in mind this is the position for the centre of the circle so you do need to account for it's radius.
And we use very small steps between the gradient to make it look like a solid line rather than a blurred gradient (I find that a 1px difference helps prevent aliasing on the line and makes everything look much smoother)
You can adjust the size of the circle or the thickness of the line by changing the 30px, 31px, 34px and 35px values in the gradient.
Working example:
.item {
position: relative;
width: 200px;
height: 200px;
background: url(https://picsum.photos/seed/picsum/200/200);
}
.item:before {
position: absolute;
content: '';
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1;
/* This is the ring itself, you can adjust it's size using the pixel values, leaving 1px differnce usually leaves the best result for smooth edges */
background-image: radial-gradient(circle at center 40px, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.4) 30px, rgba(0, 0, 0, 0) 31px, rgba(0, 0, 0, 0) 34px, rgba(0, 0, 0, 0.4) 35px, rgba(0, 0, 0, 0.4) 100%);
}
<div class="item"></div>
(This method is browser compatible with pretty much every browser released since 2010)
Infinite box-shadow with overflow: hidden; I don't know if it would work for you, I just tried-
<style>
.item img {
max-width: 100%;
vertical-align: top;
}
.item {
font-family: 'Amiri', serif;
width: 300px;
margin: 20px auto;
overflow: hidden; /* STEP-1 */
position: relative;
}
.rate {
position: absolute;
width: 100px;
height: 100px;
border-radius: 100%;
background: rgba(0,0,0,.7);
top: 80px;
left: 50%;
transform: translatex(-50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 22px;
color: #fff;
}
.rate::before {
position: absolute;
content: '';
width: calc(100% + 10px);
height: calc(100% + 10px);
top: -5px;
left: 50%;
transform: translatex(-50%);
border-radius: 100%;
box-shadow: 0 0 0 100vh rgba(0,0,0,.7); /* STEP-2 */
}
.amount {
font-size: 20px;
font-weight: 700;
display: block;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Amiri:wght#400;700&display=swap" rel="stylesheet">
<div class="item">
<img src="https://images.pexels.com/photos/4888690/pexels-photo-4888690.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="Card title">
<span class="rate">
<span class="amount">١٠</span> امتیاز
</span>
</div>
You could use a few divs with position: absolute:
body {
margin: 0;
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
.bg {
height: 100vh;
width: 100%;
background-image: url('https://i.ytimg.com/vi/fqumdSlyLxg/maxresdefault.jpg');
filter: brightness(0.4);
}
.circle {
position: absolute;
height: 150px;
width: 150px;
border-radius: 50%;
backdrop-filter: brightness(5);
-webkit-backdrop-filter: brightness(5);
z-index: 0;
}
.inner-circle {
position: absolute;
height: 142px;
width: 142px;
border-radius: 50%;
backdrop-filter: brightness(0.2);
-webkit-backdrop-filter: brightness(0.2);
z-index: 1;
}
.rate {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-evenly;
position: absolute;
height: 142px;
color: white;
z-index: 2;
}
.amount {
font-size: 30px;
border-radius: 50%;
text-shadow: 0px 0px 5px #fff;
}
<div class="container">
<div class="bg"></div>
<div class="circle"></div>
<div class="inner-circle"></div>
<div class="rate">
<span class="amount">10</span>
<span class="amount">امتیاز</span>
</div>
</div>
Use the backdrop-filter property to set the brightness and display: flex on the container to center everything, then for the text use text-shadow to make it luminous.
As an alternative, I made .item and its child elements Flexbox containers for easy positioning.
The circle is simply a circular element with a border.
All you have to do now is fiddle with sizes, colors and tranparency.
For the fun of it I added some :hover effects...
snippet with comments
/* All are FBL containers, for easy positioning */
.item, .item>*, .rate {
display: flex;
justify-content: center; align-items: center;
}
.rate { flex-direction: column }
/* item content */
.item {
position: relative; /* position child elements to this parent */
width: 400px;
height: 600px;
/* set image to background of item */
background-image: url("https://i.ytimg.com/vi/fqumdSlyLxg/maxresdefault.jpg");
background-repeat: no-repeat;
background-size: cover; /* clip/stretch when too large/small */
background-color: rgba(0,0,0,0.3); /* some tranparent black */
background-blend-mode: overlay; /* mix bg-color with image */
/* eye-candy */
margin: 5rem auto; /* center */
font-size: 1.5em;
font-weight: bold;
color: rgba(255,255,255,.6);
border-radius: 12px;
}
.item>* {
position: absolute; /* position child inside parent */
width : 100px; height: 100px;
opacity: 0.7;
}
.rate { text-shadow: 0px 0px 7px rgba(255,255,255,.8) }
.circle {
border: 5px solid rgba(255,255,255,.3);
border-radius: 50%;
filter: blur(1px);
}
/******************************/
/* HOVER eye-candy, demo only */
/******************************/
.item:hover {
background-blend-mode: normal;
color: rgba(255,255,255,1);
}
.item:hover>* {
opacity: 1;
}
.item:hover .circle {
border-color: rgba(255,255,255,.8);
}
/* demo eye-candy */
.item {
/* GMC elevation 1dp */
box-shadow: 0px 2px 1px -1px rgba(0,0,0,.20),
0px 1px 1px 0px rgba(0,0,0,.14),
0px 1px 3px 0px rgba(0,0,0,.12);
}
.item:hover {
transform: scale(1.01);
/* GMC elevation 3dp */
box-shadow: 0px 3px 3px -2px rgba(0,0,0,.20),
0px 3px 4px 0px rgba(0,0,0,.14),
0px 1px 8px 0px rgba(0,0,0,.12);
}
/*.item:active:not(:focus) { transform: scale(1) }/* enable for some animation */
<div class="item">
<div class="circle"></div>
<div class="rate">
<span class="amount">10</span>
<span>text</span>
</div>
</div>

Cannot reduce div height without having visualization issues

in this codepen:https://codepen.io/anon/pen/GGrVdK
I cannot reduce the height of the div having class foul-row to 4px height, given that every foul div is 4px tall.
.foul{
background: linear-gradient(to bottom right, rgb(0,0,0), rgb(92,92,92));
height: 4px;
margin-top:0;
margin-bottom: 0;
margin-right: 2px;
width: 15px;
display: inline-block;
}
If I try to set a height to foul-row class, either I have scrollbars in the containing cell div, or I can't see foul divs.
Here there is cell class
.cell{
padding: 6px 8px 0 8px;
white-space: nowrap;
font-size: 13px;
min-width: 27px;
display: block;
overflow: auto;
height: 36px; /*I would like to remove this, but if I do, I have visualization problems*/
}
and this is the structure of the "incriminated" cell
<div class="cell white">
<div>Home Team</div>
<div class="foul-row">
<div class="foul"></div><div class="foul"></div><div class="foul">/div><div class="foul"></div><div class="foul"></div>
</div>
</div>
How can I reduce foul-row height to fit foul height and reduce the total height of cell div? Thanks
Your height:4px is being overriteen by the font-size, which is by default 16px,because it needs to have space for the text to show up.
Now since div.foul doesn't have any text it will be fine to set it's font to 0.
body {
font-family: 'Fjalla One', sans-serif;
text-transform: uppercase;
letter-spacing: 0.02em;
/* background-image: url(https://dynamitick.com/wp-content/uploads/2018/01/legnano-basket-19-sempione-news.jpg); */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
height: 100%;
}
.red {
background-color: rgba(255, 0, 0, 0.7);
color: white;
}
.blue {
background-color: rgba(0, 0, 255, 0.7);
color: white
}
.black {
background-color: rgba(0, 0, 0, 0.7);
color: white;
}
.green {
background-color: rgba(0, 128, 0, 0.7);
color: white;
}
.yellow {
background-color: rgba(255, 255, 0, 0.7);
color: blue;
}
.white {
background-color: rgba(255, 255, 255, 0.7);
color: blue;
}
.grey {
background-color: rgba(128, 128, 128, 0.7);
color: white;
}
.score {
text-align: right;
}
.cell {
padding: 6px 8px 0 8px;
/* display: inline-flex; */
/* overflow: auto; */
white-space: nowrap;
font-size: 13px;
min-width: 27px;
/* min-height: 16px; */
display: block;
overflow: auto;
height: 36px;
/* text-overflow: ellipsis */
}
.shadow {
background: linear-gradient(rgba(255, 255, 255, 1), rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));
}
.column {
display: inline-block;
height: 100%;
}
.separator {
display: inline-block;
width: 1px;
}
.timer {
/* width: 60px; */
text-align: center;
}
.container {
border-radius: 10px;
overflow: hidden;
display: table;
clear: both;
font-size: 0;
animation-name: rotation;
animation-duration: 1s;
border: 1px solid grey;
}
#keyframes rotation {
from {
transform: rotateX(90deg);
}
to {
transform: rotateX(0deg);
}
}
.bottom-left {
position: absolute;
bottom: 3vh;
left: 2vh;
}
.bottom-right {
position: absolute;
bottom: 3vh;
right: 2vh;
}
.top-right {
position: absolute;
top: 3vh;
right: 2vh;
}
.top-left {
position: absolute;
top: 3vh;
left: 2vh;
}
.message-title {
text-align: center;
}
.message-body {
text-align: center;
min-width: 150px;
background-color: rgba(0, 0, 0, 0.66);
color: white;
text-transform: none
}
.half-shadow-up {
background: linear-gradient(rgba(255, 255, 255, 1), rgba(128, 128, 128, 1));
}
.tv-logo img {
max-width: 150px;
max-height: 150px;
margin: auto;
}
.foul {
background: linear-gradient(to bottom right, rgb(0, 0, 0), rgb(92, 92, 92));
height: 4px;
margin-top: 0;
margin-bottom: 0;
font-size: 0;
margin-right: 2px;
width: 15px;
display: inline-block;
}
.foul-row {
height: 4px;
}
<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
<div class="container shadow top-right">
<div class="column timer">
<div class="cell red"><span>00:00</span></div>
<div class="cell red">Q4</div>
</div>
<div class="separator"></div>
<div class="column">
<div class="cell white">
<div>Home Team</div>
<div class="foul-row">
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
</div>
</div>
<div class="cell green">
<div>Guest team</div>
<div class="foul-row">
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
</div>
</div>
</div>
<div class="separator"></div>
<div class="column score">
<div class="cell white">
100
</div>
<div class="cell green">
65
</div>
</div>
</div>
<div class="container bottom-left">
<div class="column">
<div class="cell white half-shadow-up message-title">
10 A. Player
</div>
<div class="cell message-body">
24 pts, 8 reb
</div>
</div>
</div>
Please try adding your height:4px to foul-row after changing the overflow property on your cell element to hidden:
.cell{
padding: 6px 8px 0 8px;
white-space: nowrap;
font-size: 13px;
min-width: 27px;
display: block;
overflow: hidden; /* changed */
height: 36px;
}

Setting modals size to 100%

I have created a modal inside a button-container which utilizes some flex display elements.
The problem occurs when I want to size the .modal-mask to a 100% of width/height to the whole page (body) size which is my goal here, I can't seem to get it to adjust properly without disturbing my button-container elements.
In short, I want the inner div .modal-mask to be sized 100% to the body
Project Fiddle: https://jsfiddle.net/est857q0/
HTML:
<ul id="button-container">
<li>
<a id="html-modal-button" #click="showModal = 'html-modal'">
<img class="htmllogo" src="http://sweettutos.com/wp-content/uploads/2015/12/placeholder.png">
</a>
<htmlmodal v-if="showModal === 'html-modal'" #close="showModal = false"></htmlmodal>
</li>
<li>
<a id="cs-modal-button" #click="showModal = 'cs-modal'">
<img class="csharplogo" src="http://sweettutos.com/wp-content/uploads/2015/12/placeholder.png">
</a>
<csmodal v-if="showModal === 'cs-modal'" #close="showModal = false"></csmodal>
</li>
</ul>
<!-- MODAL SECTION -->
<script type="text/x-template" id="html-modal-template">
<transition name="html-modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-content">
<slot name="body">
<button class="modal-default-button" #click="$emit('close')">HTML CLOSE</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
<script type="text/x-template" id="cs-modal-template">
<transition name="cs-modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-content">
<slot name="body">
<button class="modal-default-button" #click="$emit('close')">CS CLOSE</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
CSS:
/*Global*/
html {
margin-right: calc(100% - 100vw);
/*overflow: hidden;*/
}
body {
margin: 0 auto;
background-image: url('../images/wallpaper.jpg');
font-family: 'Josefin Sans', sans-serif;
}
*::selection {
background-color: red;
}
/*Header*/
h1 {
text-transform: uppercase;
width: 100%;
font-size: 9vw;
text-align: center;
margin-top: 4vh;
}
/*Containers*/
#button-container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
margin-top: 40vh;
margin-left: 50vw;
transform: translate(-50%, -70%);
width: 90vw;
height: 45vh;
align-items: baseline;
background: linear-gradient(to right, transparent 0%, #fff 33%, #fff 66%, transparent 100%);
}
#button-container li {
position: relative;
display: inline-block;
cursor: pointer;
}
#button-container .html-text-block,
.cs-text-block {
position: absolute;
bottom: 4px;
width: 100%;
height: 30%;
box-sizing: border-box;
background-color: #fff;
padding-left: 5px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
transition: box-shadow 0.5s cubic-bezier(.25, .8, .25, 1), transform 0.5s cubic-bezier(.25, .8, .25, 1);
}
#button-container .htmllogo,
#button-container .csharplogo {
width: 150px;
}
#button-container {
border: 1px solid #000;
}
img:hover {
transform: scale(1.1);
}
/* THE MODAL CSS SECTION */
/*Main Modal container*/
.modal-mask {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
display: table;
transition: opacity .3s ease;
}
.modal-wrapper {
display: table-cell;
vertical-align: middle;
}
.modal-container {
width: 300px;
margin: 0px auto;
padding: 20px 30px;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}
.modal-content {
margin: 20px 0;
}
I attempted to set the button-container too 100% : https://jsfiddle.net/est857q0/ yet this messes up the flow

Background outside CSS Bottom Border

first question here so please be kind! I am designing a website and I've been asked to frame pictures in sine-like borders. So far I've gotten around to it by creating a container div with 3 divs: the first for the downward bend, the second is just straight (I'm considering the idea of removing it later on) and the third one does the upward bend.
Here's a screenshot of the current state
So this is the the current code:
.border {
overflow: hidden;
align-items: center;
height: auto;
width: 100%;
display: flex;
}
.bord1 {
margin-top: 4vh;
height: 4vh;
flex: 1;
border-top: solid 5px;
border-color: #e4ae03 rgba(0, 0, 0, 0) transparent transparent;
border-radius: 100% 0 0 0;
z-index: 999;
}
.bord2 {
margin-top: 4vh;
flex: 1;
display: inline;
height: 4vh;
border-top: 5px solid #e4ae03;
}
.bord3 {
margin-top: -4vh;
flex: 1;
height: 4vh;
display: block;
border-bottom: 5px solid;
border-color: transparent transparent #e4ae03 transparent;
border-radius: 0 0 100% 0;
}
<div class="border">
<div class="bord1 top top-bord"></div>
<div class="bord2 top top-bord"></div>
<div class="bord3 bottom"></div>
</div>
I'm really trying to figure out how to get the last segment white, as it's created by rounding the bottom right corner, so the white background would have to be "outside" the div.
I know this might be a stupid question, but here it is! Thanks!
*Edit: Sorry everyone, here is an image of what I'm trying to do]2
It would need minor adjustments to the spacing, but something along these lines? (I used black/white backgrounds to show the sections, but these could be swapped or even made transparent.
body{background-color:black;}
.border{
overflow: hidden;
align-items: center;
height: auto;
width: 100%;
display: flex;
background-color:white;
}
.bord1{
margin-top: 4vh;
height: 4vh;
flex:1;
border-top: solid 5px;
border-color:#e4ae03 rgba(0,0,0,0) transparent transparent;
border-radius: 100% 0 0 0;
z-index: 999;
background-color:black;
}
.bord2 {
margin-top: 4vh;
flex: 1;
display: inline;
height: 4vh;
border-top: 5px solid #e4ae03;
background-color:black;
}
.bord3{
border-bottom: 5px solid;
border-color: transparent transparent #e4ae03 transparent;
border-radius: 0 0 100% 0;
background-color:white;
height:4vh;
}
.bord3-layer{
flex: 1;
height: 9vh;
display: block;
background-color:black;
}
<!DOCTYPE html>
<HTML>
<head>
<style>
</style>
</head>
<body>
<div class="border">
<div class="bord1 top top-bord"></div>
<div class="bord2 top top-bord"></div>
<div class="bord3-layer">
<div class="bord3 bottom"></div>
</div>
</div>
</body>
</HTML>
Ok, in the end I was able to fix the layout using a system of inner divs, here is how I handled it:
.container {
line-height: 1.5rem;
margin-top: -5vh;
padding: 0px 0px 0px;
padding-top: 5vh;
padding-bottom: 0px;
z-index: 0;
color: #b3b5b3;
background: -webkit-linear-gradient(left, #1b2716, #000000 80%);
background: -o-linear-gradient(left, #1b2716, #000000 80%);
background: -moz-linear-gradient(left, #1b2716, #000000 80%);
background: linear-gradient(left, #1b2716, #000000 80%);
min-height: 75vh;
}
.top {
box-shadow: inset 0 6px 0 0px #243c51;
}
.bottom {
box-shadow: 0 6px 0 0px #243c51;
}
.border{
overflow: hidden;
align-items: center;
height: auto;
width: 100%;
display: flex;
}
.bord1{
margin-top: 4vh;
height: 4vh;
flex:1;
border-top: solid 5px;
border-color:#e4ae03 rgba(0,0,0,0) transparent transparent;
border-radius: 100% 0 0 0;
z-index: 999;
}
.bord1-bot{
background: white;
}
.bord2 {
margin-top: 4vh;
flex: 1;
display: inline;
height: 4vh;
border-top: 5px solid #e4ae03;
}
.bord2-bot {
background: white;
margin-bottom: 4vh;
flex: 1;
display: inline;
height: 4vh;
border-bottom: 5px solid #e4ae03;
}
.bord3{
flex: 1;
height: 4vh;
display: block;
border-bottom: 5px solid;
border-color: transparent transparent #e4ae03 transparent;
border-radius: 0 0 100% 0;
}
.bord3-top {
margin-top: 0vh;
background: black;
}
.bord3-bot {
margin-top: 0vh;
background: white;
}
.bord3-bottom {
background: white;
}
.bord3-layer-top{
flex:1;
height: 8.5vh;
display: block;
background-color: white;
}
.bord3-layer-bot{
flex:1;
height: 8.5vh;
display: block;
}
.bord1-layer-top{
flex:1;
height: 8.5vh;
display: block;
background-color: white;
}
.bot-bord {
background: -webkit-linear-gradient(left, #1b2716, #000000 240%);
}
.text-con {
padding: 2vw;
z-index: 2;
}
.image-within {
display: block;
background: yellow;
height: 200px;
z-index: 10;
}
.top-bord {
background: white;
}
<div class="container">
<div class="border">
<div class="bord1 top top-bord"></div>
<div class="bord2 top top-bord"></div>
<div class="bord3-layer-top">
<div class="bord3 bottom bord3-top"></div>
</div>
</div>
<div class="image-within">
</div>
<div class="border">
<div class="bord1-layer-top"><div class="bord1 top bot-bord"></div></div>
<div class="bord2-bot bottom"></div>
<div class="bord3-layer-bot">
<div class="bord3 bottom bord3-bot"></div>
</div>
</div>
</div>
The CSS is really messy at the moment, so I'll have to clean it up a bit and work on keeping all the items constantly aligned, but it's looking pretty good right now! Thanks LegendaryJLD!