Display full text vertically in css - html

This css displays the outlined text when I hover over the filled text.Im displaying the text vertically, but the part I'm having a problem with is the full text should display vertically and the next full text displaying vertically to the right of it and so on. But right now it displays one word of the sentence and then to the right of it the next word and so on. How can I fix this?
JS:
return (
<div className="body">
<>
<div className='X-ray'>
<span className="filled-text">
Тавтай морилно уу.
Тавтай морилно уу.
Тавтай морилно уу.
Тавтай морилно уу.
</span>
<span className="outlined-text" aria-hidden="true">
Тавтай морилно уу.
Тавтай морилно уу.
Тавтай морилно уу.
Тавтай морилно уу.
</span>
<div id="circle"></div>
</div>
</>
</div>
);
CSS:
* {
::selection {
background: none;
}
font-family: sans-serif;
letter-spacing: -5px;
cursor: grabbing;
margin: 0px;
box-sizing: border-box;
position: absolute;
}
body {
background: #3590f3;
overflow: hidden;
height: 100vh;
writing-mode: vertical-lr;
text-orientation: sideways-right;
}
span {
width: 100vw;
padding: 5rem;
font-size: 5rem;
font-weight: bold;
line-height: 4rem;
text-align: center;
top: 50vh;
left: 50vw;
transform: translate(-50%, -50%);
}
#media screen and (max-width: 768px) {
span {
padding: 5px;
font-size: 3rem;
line-height: 2.5rem;
}
}
span.filled-text {
color: #fff;
z-index: 0;
}
span.outlined-text {
color: transparent;
-webkit-text-stroke: 0.5px #fff;
z-index: 2;
}
#circle {
height: 200px;
width: 200px;
border-radius: 50%;
background: #3590f3;
border: 20px solid #fff;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
top: calc(50vh - 100px);
left: calc(50vw - 100px);
}
the current render
I have tried changing the font-size and padding, but to no avail.

Related

Is it possible to make a text inside horizontal line like i'm doing?

I don't get it what i doing wrong here. I want the small text to look a like the big one without fixed values (run the snipped to see)
Have some way to do this that don't involves text being surrounded by two pseudo-elements?
.ruler {
border-bottom: 1px solid black;
text-align: center;
height: 0px;
}
.text1 {
background-color: white;
padding: 0px 2px;
transform: translateY(-50%);
display: inline-block;
font-weight: 500;
font-size: 12px;
}
.text2 {
background-color: white;
padding: 0px 2px;
transform: translateY(-50%);
display: inline-block;
font-weight: 500;
font-size: 16px;
}
<div class="ruler">
<span class="text1">MyText</span>
</div>
<br />
<br />
<div class="ruler">
<span class="text2">MyText</span>
</div>
I am curious to what you mean by I want the small text to look a like the big one without fixed values (run the snipped to see) I have an example of making them the same. Can you please provide some clarification below if this is not what you are looking for? Possibly a screenshot example of what you are looking for in your original question may be the most helpful.
.ruler {
border-bottom: 1px solid black;
text-align: center;
height: 0px;
}
.text {
background-color: white;
padding: 0px 2px;
transform: translateY(-50%);
display: inline-block;
font-weight: 500;
font-size: 16px;
}
<div class="ruler">
<span class="text">MyText</span>
</div>
<br />
<div class="ruler">
<span class="text">MyText</span>
</div>
you can use
::after or ::before
.title {
width: 100%;
text-align: center;
position: relative;
}
.title::before {
content: '';
z-index: -1;
width: 100%;
height: 2px;
background: #000;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
span.text2 {
font-size: 18px;
background: #fff;
}
<div class="title">
<span class="text2">MyText</span>
</div>
I used :
:before
it's relative to the div that has the span, I center it with top, left, and transform properties will make it however the size of the span, it will be always in the center
Note: that it's a line passing through the whole div, so I gave the span background so it will cover it, and give you the possibility to control the padding from the text and line
hope it's useful
Sorry for all the confusion, I eventually solved the problem by going the other way around.
I would delete this question and add this answer to a related question, but I can do neither.
Whatever... here's the answer:
.ruler {
border-bottom: 1px solid black;
text-align: center;
}
.text1 {
background-color: white;
padding: 0px 2px;
transform: translateY(50%);
display: inline-block;
font-weight: 500;
font-size: 12px;
padding-top: 2px;
}
.text2 {
background-color: white;
padding: 0px 2px;
transform: translateY(50%);
display: inline-block;
font-weight: 500;
font-size: 16px;
padding-top: 2px;
}
<div class="ruler">
<span class="text1">MyText</span>
</div>
<br />
<br />
<div class="ruler">
<span class="text2">MyText</span>
</div>
The padding-top: 2px acts the same with all text sizes, because it's there to compensate the border size.

trouble resizing image in "cards with overflowing images layout."

I am using a card-based layout from codepen and each card contains an image. On codepen, I am able to resize and adjust the image that appears on the card with no issues. However, when implementing the same exact html code and stylesheet on my browser, the image I am resizing does not respond to any changes made to code contained within "{ img" like it does on codepen. While I was able to adjust the margins of the card wrap to make things appear as I desire, I am wondering what the root of the issue is with my code. Thanks!
<!--DOCTYPE html-->
<html lang="en">
<head>
<html>
<link href="home.css" type="text/css" rel="stylesheet" />
<title>Purple Moss</title>
<!-- inspiration: https://dribbble.com/shots/3784003-Plant-description-page -->
<div class="wrap">
<div class="card">
<div class="card-pic-wrap">
<img src="https://imagizer.imageshack.com/v2/320x240q90/922/MeU4GZ.png" alt="A leafy plant">
</div>
<div class="card-content">
<h3>summary:</h3>
<p>Blossom dorset heath scabious ipsum. Grape hyacinth bee balm bird of paradise obedient plant african lily lily. Spring foxglove florist’s nighmare primrose.</p>
<p>So leafy</p>
</div>
</div>
<div class="card">
<div class="card-pic-wrap">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1145795/plant-4.png" alt="Some pointy plants">
</div>
<div class="card-content">
<h3>Some pointy ones</h3>
<p>Florem ipsum sugarbush bloom red rose waxflower coneflower ginger. Saxifrage forget-me-not obedient plant.</p>
<p>I'll take 10</p>
</div>
</div>
</div>
</html>
/* CSS */
$b-r: 5px;
* {
box-sizing: border-box;
}
html, body {
height: 100%;
}
body {
background: #eee;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
font-family: "Courier New", Courier, monospace;
}
.wrap {
height: 100%;
}
.card {
display: flex;
flex: 0 0 auto;
background: #fff;
max-width: 700px;
margin: 80px 0;
border-radius: $b-r;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.card-pic-wrap {
border-radius: $b-r 0 0 $b-r;
width: 200px;
flex: 0 0 auto;
position: relative;
background: linear-gradient(to bottom, #f5e4b5, #a19ad9);
img {
position: relative;
bottom: 3em;
left: 50%;
margin-left: -175px;
width: 350px;
-webkit-box-reflect: below -1px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(90%, transparent), to(rgba(250, 250, 250, 0.15)));
}
}
.card-content {
padding: 3em 4em 2em;
}
h3 {
font-family: "Courier New", Courier, monospace;
font-weight: bold;
font-size: 2.5em;
margin: 0 0 1em;
}
a {
background: #f5e4b5;
color: #15077d;
padding: 0 25px;
height: 50px;
font-size: 0.8em;
letter-spacing: 1px;
line-height: 50px;
display: inline-block;
border-radius: 25px;
text-decoration: none;
margin-top: 1.5em;
text-transform: uppercase;
border: 1px solid rgba(0,0,0,0.1);
&:hover {
background: #15077d;
color: #f5e4b5;
border: 2px dotted #f5e4b5;
}
}
#media (max-width: 790px) {
body {
overflow-x: hidden;
}
.wrap {
margin-left: 20px;
margin-right: 20px;
}
.card {
flex-direction: column;
margin-top: 50px;
margin-bottom: 50px;
}
.card-pic-wrap {
width: 100%;
border-radius: $b-r $b-r 0 0;
img {
bottom: 20px;
position: relative;
}
}
.card-content {
padding: 2em 2em 1em;
}
}
Never mind, I think I found the issue.
The template code I was using on codepen contained the "img {" within the ".card-pic-wrap {" and did not close off "img {" with closing bracket "}." Rather, it closed off both of these elements with double brackets, which worked fine in codepen but not in browser.

How to make image swallowed out of window size without create blank space

this is something I built:
https://i.imagesup.co/images2/e51854cad0f72ef2900debd5518472d71713cc71.png
There is no overflow because I put in body tag overflow-x:hidden, and it's kind of "nasty" way.
I tried to set div container as width:100vw,max-width:100vw; but it's still not helping. tried to do it with a negative margin and every possible way I know but it's still create overflow like this:
https://i.imagesup.co/images2/794cf0f60d80b8a2de4f5ac44d93579bd50ace2d.png
This the relevant code of the light blue part, thanks in advance:
<body>
<div id="divStyle1">
<header>
<h1>
<span>How to <span class="importantH1">ripen Avocado</span> quickly ?</span>
<span><span class="importantH1">RFP bags</span> ripen Avocado within <span class="importantH1">12-24 hours !</span></span>
</h1>
</header>
<main>
<div id="purpuleLineBox">
<div id="purpuleLine1"> <p>100% recyclable and bio-degradable</p> </div>
<div id="purpuleLine2"> <p>Simulates the natural ripening process, organic</p> </div>
<div id="purpuleLine3"> <p>The quickest way to achieve the perfect avocado taste</p> </div>
<div id="purpuleLine4"> <p>Work with Mango, Banana, Peach, and another climacteric fruits</p> </div>
<div id="purpuleLine5"> <p>The user interface on the bag shows when an avocado is fully ripen</p> </div>
</div>
<img id="logoImg" src="Logo.png" alt="">
</main>
</div>
</body>
body {
margin: 0 auto;
}
html {
scroll-behavior: smooth;
}
#divStyle1 {
height: 90vh;
background-color: #016087;
}
h1>span {
display: block;
}
h1 {
color: white;
text-shadow: 2px 2px black;
font-size: 45px;
margin: 0 auto;
}
.importantH1 {
border-bottom: 10px solid #D52C82;
font-size: 53px;
}
.importantH1:hover {
border-bottom: 15px solid #D52C82;
font-size: 55px;
transition-duration: 0.5s;
}
#logoImg {
position: absolute;
right: -20px;
top: 10vh;
transform: rotate(8deg);
border: 20px dashed white;
padding-left: 20px;
padding-bottom: 20px;
padding-bottom: 20px;
}
#purpuleLineBox {
margin-top: 100px;
}
#purpuleLine1 {
background-color: #D52C82;
height: 50px;
width: 34%;
margin-bottom: 30px;
}
#purpuleLine2 {
background-color: #D52C82;
height: 50px;
width: 44%;
margin-bottom: 30px;
}
#purpuleLine3 {
background-color: #D52C82;
height: 50px;
width: 52%;
margin-bottom: 30px;
}
#purpuleLine4 {
background-color: #D52C82;
height: 50px;
width: 58%;
margin-bottom: 30px;
}
#purpuleLine5 {
background-color: #D52C82;
height: 50px;
width: 60%;
margin-bottom: 30px;
}
div>p {
font-size: 30px;
color: white;
text-shadow: 2px 2px black;
font-weight: bold;
margin-top: 0px;
}
This is happening due to a combination of using absolutely positioned right: -20px; and transform: rotate(8deg); if you remove the transform and set right to 0 it should not have the blank space.
If you want to keep these styles just use overflow-x: hidden;

How can I contain an anchor tag inside my button tag at 100% width and height

I started doing a website and I have a problem.
I started making my navigation bar, here's the code:
<div class="navGrid">
<div class="first">ZENZZEX </div>
<div class="span-col-4 second">
<button>Services</button>
<button>About us</button>
<button>Contact us</button>
</div>
<div class="third"><button>Get Started</button></div>
</div>
and the problem is that this <a> tag is taking space outside my button area. Here's a full code on Codepen:
https://codepen.io/MareGraphics/pen/GwqpOy
What I want is to contain A tag to fit 100% inside my button, not outside od it.
Thank You
The reason you cannot adjust the height and width of your <a> is because anchor elements are inline-elements.
An inline element does not start on a new line and only takes up as much width as necessary.
If you want to adjust the height and width you would need to specify another display property, e.g.
a { display: inline-block; }
For what it's worth, it's better to omit the button inside the anchor tag, just style the anchor tag as your button to make it act like a button.
e.g. if you are using bootstrap, you can do
Get Started
Use this code:
<a style="padding:50px;background-color:gray;width100%;line-height:70px;" class="btn btn-info">Buttons</a>
Remove your buttons from navgrid div and change the CSS like this
body {
margin: 0;
}
.navGrid {
display: grid;
grid-template-columns: repeat(6, 1fr);
position: fixed;
width: 100%;
top: 0;
background-color: white;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
}
.span-col-4 {
grid-column: span 4 / auto;
}
.navGrid .first {
color: black;
text-align: center;
font-family: 'Dosis', sans-serif;
font-size: 1.2em;
font-weight: 800;
background-color: white;
border-right: 1px solid rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
justify-content: center;
transition: .5s;
}
.navGrid .first:hover {
cursor: pointer;
font-size: 1.31em;
}
.navGrid {
height: 40px
}
.navGrid .second {
display: flex;
padding-left: 50px;
border-style: none;
background-color: white;
font-family: 'Dosis', sans-serif;
text-transform: uppercase;
transition: .5s;
}
.navGrid .second a {
padding: 10px;
}
.navGrid .second a:hover {
background-color: rgba(0, 0, 0, 0.2);
text-decoration: none;
}
.navGrid .second:hover {
cursor: pointer;
}
.navGrid .third {
display: flex;
padding-left: 50px;
border-style: none;
background-color: rgb(0, 26, 255);
font-family: 'Dosis', sans-serif;
text-transform: uppercase;
transition: .5s;
color: white;
}
.navGrid .third a {
padding: 10px;
}
.navGrid .third:hover {
background-color: rgb(3, 25, 219);
cursor: pointer;
}
.navGrid .third {
border-left: 1px solid black;
}
.content {
background-color: green;
height: 2000px;
}
<div class="navGrid">
<div class="first">ZENZZEX </div>
<div class="span-col-4 second">
Services
About us
Contact us
</div>
<div class="third">Get Started</div>
</div>
I think this may help you.

Resizing content in a div inside flex box pushes other content outside of box

As part of my HTML5/CSS3 app, I need to implement zoomable image popup. When the user clicks on a small image, a full-screen popup appears containing that image in the middle with a title above it and a button to close the popup below it. Clicking on the image then removes any scaling and puts it full-size inside a box in the middle to allow scrolling - with title and "close" button staying above and below.
I'm using flex (for several reasons, including vertical centering content). The overall popup works and looks fine. Clicking on the image does increase it in size, but it resizes the box so that the "done" button is pushed below the overall popup.
Here's the jsfiddle demonstrating the issue
I don't mind the fact that the box resizes - the more room to view/scroll the larger image - but I need to ensure that the button at the bottom stays put relative to the bottom edge of the popup.
My HTML looks like this (I used a random image for demonstration):
<div id="overlay" class="hidden">
<div id="alsg">
<div class="intro">Assist with ALS</div>
<div class="box scrollable">
<img src="http://upload.wikimedia.org/wikipedia/commons/8/8c/Male_monarch_butterfly.JPG" class="fit" />
</div>
<div class="popup-buttons">
<div id="button-alsg-done" class="button button-state-action button-green right">Done</div>
<div class="clear"></div>
</div>
</div> <!-- alsg -->
</div>
With the javascript being
$('img', '#alsg').on('click', function(e) {
$(this).toggleClass('fit');
});
There's a lot of CSS, unfortunately. You'll note that there's a pretty bad mix of flex and old-school positioning. This is because the app initially didn't use flex at all and I'm in a slow process of migrating/cleaning up now.
div#overlay {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
z-index: 104;
display: flex;
align-items: center;
justify-content: center;
}
div#overlay > div {
position: relative;
width: calc(100% - 40px);
margin: 10px auto;
background-color: #A9A9A9;
border-radius: 8px;
text-align: center;
padding: 10px;
display: flex;
flex-direction: column;
}
div#alsg {
max-height: calc(100% - 40px) !important;
}
div#overlay div.intro {
color: #FFF !important;
font-size: 12pt;
margin-bottom: 10px;
}
div#overlay div.box, div.template div.box {
padding: 3px 5px;
overflow: hidden;
font-weight: bold;
position: relative;
flex-grow: 1;
}
div#alsg div.box {
text-align: center;
position: relative;
overflow: auto !important;
margin: 10px 0px 0px !important;
}
div.box {
background-color: #FFF;
color: #27374A;
border-radius: 8px;
border: 3px solid #FBE96E;
position: relative;
margin: auto;
flex-shrink: 1;
}
.fit {
max-width: calc(100% - 4px) !important;
max-height: calc(100% - 4px) !important;
}
div.popup-buttons {
margin-top: 10px;
}
#overlay .button.right {
margin-left: 10px;
}
#button-alsg-done {
margin-top: 10px;
flex-basis: 25px;
}
div.button-green {
background-color: #2CC55D;
color: #FFF;
font-weight: bold;
}
div.button-state-action {
height: 25px;
padding: 0px 5px;
line-height: 25px;
text-align: center;
border-radius: 4px;
font-size: 10pt;
font-weight: normal !important;
width: 60px;
cursor: pointer;
margin-bottom: 5px;
}
div.button {
height: 22px;
padding: 0px 2px;
line-height: 22px;
text-align: center;
border-radius: 4px;
font-size: 9pt;
width: 42px;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
}
.right {
float: right;
}
.clear {
clear: both;
}