webkit-text-stroke cutting the stroke [duplicate] - html

This question already has an answer here:
Outline effect to text in Arabic using CSS
(1 answer)
Closed 9 months ago.
webkit-text-stroke is not working suitable, I would like to have the text stroke affect like that:
but it appears like that without cutting:
as you can seen when I write long Arabic Text like thet (ملاعــــــب) or (أهــــــــلاً) it is cutting the stroke like that:
this is my code with cutting:
.myText {
font-family: 'DIN Next LT Arabic';
font-style: normal;
font-weight: 500;
font-size: 48px;
line-height: 71px;
/* identical to box height */
display: flex;
align-items: center;
text-align: right;
letter-spacing: -0.02em;
color: #FFFFFF;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #2A34BF;
text-shadow: 2px 1.3px 0px #E34D32, 2px 2px 0px #D6F46B;
}
I also need a multi-layes shadow to be like that in the final result:

Finally, I have resolved it and reach the final result using web the text-shadow to make all the texts joined and with about 1px stroke method provided by #kameron
and to create the multi-layered shadow I have used filter and add the numbers of drop shadow I needed
this is the final result same as the final result I needed in the post:
.bg{
background:#2A34C0;
padding:20px;
}
.myText {
font-family: 'DIN Next LT Arabic';
font-style: normal;
font-weight: 500;
font-size: 90px;
line-height: 71px;
display: flex;
align-items: center;
text-align: right;
letter-spacing: -0.02em;
color: #FFFFFF;
text-shadow:
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0,
0 0 1px #2A34C0;
filter:
drop-shadow(-1px -1px 0px #2A34C0)
drop-shadow(1px 1px 0px #2A34C0)
drop-shadow(3px 2px 0px #D6F46B)
drop-shadow(3px -1px 0px #E34D32);
}
<div class="bg">
<p class="myText">
أهــــــــلاً ملاعــــــب
</p>
</div>

Related

Font outline using only CSS

I'm working on adding a black font outline to white text using CSS. The goal is the image below. So far I've been able to come up with below. Is there any other best practice to closer match the thin outline shown in the image below? Thanks!
.introText {
font-family: 'Nunito', sans-serif;
-moz-text-fill-color: white;
-webkit-text-fill-color: white;
-moz-text-stroke-color: black;
-webkit-text-stroke-color: black;
-moz-text-stroke-width: 2px;
-webkit-text-stroke-width: 2px;
font-size: 50px;
margin-top: 20vh;
}
}
<h1 class='introText text-center'>We've got your perfect spot.</h1>
One way to do that is to use text-shadow and overlap multiple shadows:
.introText {
text-shadow: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black;
}
4 times in this case.
Example:
.introText {
font-family: "Nunito", sans-serif;
text-shadow: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black;
color: white;
font-size: 50px;
margin-top: 20vh;
}
<h1 class="introText text-center">We've got your perfect spot.</h1>
It creates a very similar effect and you can make it stronger or weaker depending on how many repetitions you use.
Maybe this is what your asking
.introText {
font-family: 'Nunito', sans-serif;
background: gray;
color: white;
font-size: 50px;
font-weight: 400;
border: 100px white solid;
margin-top: 20vh;
}
<h1 class='introText text-center'>We've got your perfect spot.</h1>

CSS Border/Outline With Outside Padding

I am trying to create a reusable div css class that I can use to highlight quotes in articles I am writing on my campaign website. When debugging in Visual Studio using Chrome (or Firefox) I get the desired result:
As you can see there is a silver border, but padding around it.
My CSS class is:
.articleQuote {
background-color: #FFFFFF;
font-family: 'PT Sans', sans-serif;
font-size: 20px;
color: navy;
padding: 25px 25px 25px 25px;
outline-style: solid;
outline-color: silver;
outline-width: 1px;
outline-offset: -10px;
text-align: center;
}
However, in Internet Explorer no padding on the border occurs. Seems like outline-offset is ignored.
Link to article on my website
How can I get a cross-browser class set up that will produce the desired result?
outline-offset is not supported in Internet Explorer.
You could use a combination of outline and border to achieve the same effect.
Here border is used for the silver line and outline is used for the white space surrounding the element.
body {
background: #fffacf;
padding: 15px;
}
.articleQuote {
background-color: #FFFFFF;
font-family: 'PT Sans', sans-serif;
font-size: 20px;
color: navy;
padding: 25px 25px 25px 25px;
outline-style: solid;
outline-color: white;
outline-width: 10px;
text-align: center;
border: 1px solid silver;
}
<div class="articleQuote">
"80% of North Carolinians polled were in favor of legalizing medical marijuana in the state."
</div>
Another option is to use box-shadow instead of border or outline. This allows you to have as many "borders" as you like.
body {
background: #e6e6e6;
padding: 15px;
}
.articleQuote {
background-color: #FFFFFF;
font-family: 'PT Sans', sans-serif;
font-size: 20px;
color: navy;
padding: 25px 25px 25px 25px;
text-align: center;
margin: 30px 0;
box-shadow: 0 0 0 1px silver,
0 0 0 10px white;
}
.crazy-border {
margin: 50px 10px;
box-shadow: 0 0 0 2px red,
0 0 0 4px white,
0 0 0 6px orange,
0 0 0 8px white,
0 0 0 10px gold,
0 0 0 12px white,
0 0 0 14px green,
0 0 0 16px white,
0 0 0 18px blue,
0 0 0 20px white,
0 0 0 22px purple;
}
<div class="articleQuote">
"80% of North Carolinians polled were in favor of legalizing medical marijuana in the state."
</div>
<div class="articleQuote crazy-border">
"80% of North Carolinians polled were in favor of legalizing medical marijuana in the state."
</div>
Try nested divs.
HTML:
<div class="article-quote-outer">
<div class="article-quote-inner">
{text goes here}
</div>
</div>
CSS:
.article-quote-outer {
padding: 12px;
background-color: white;
}
.article-quote-inner {
border: 1px solid silver;
padding: 15px;
}
Example:
JSFIDDLE
If the desired result is no white space surrounding the silver border, delete the line:
outline-offset: -10px;

Have image and text on top of another image

So here is my goal, I want to have image(aka that's my logo) on top of another which is basically the background. So the background image has the logo on it and also some text and both are centered. Now here is my problem, because I set position to relative and absolute, when I resize the window, my images are not responsive, meaning the logo and the text aren't centered anymore.
So what I had to do, was put the texts and the logo in a div and make the background of that div the other image (using background-url in css) the other image background but that's not efficient. So I have this so far:
#pictures {
width: 100%;
margin-top: 0;
padding-top: 100px;
padding-bottom: 100px;
background: url('http://cdn-s-www.lalsace.fr/images/3CC1D55D-083C-44F1-B484-2D315D21D529/JDE_V0_07/(disney).jpg');
background-size: 100%;
background-position: center;
background-repeat: no-repeat;
-webkit-transition: background-image 1s ease-in-out;
transition: background-image 1s ease-in-out;
}
#logo {
width: 30%;
height: auto;
padding-top: 20px;
background: none !important;
}
#line1 {
font-size: 30px;
color: white;
text-align: center;
padding-top: 40px;
margin-bottom: 4%;
letter-spacing: 0.1em;
-webkit-text-stroke: 1px white;
text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
font-family: 'IM Fell Double Pica', serif;
}
#line2 {
font-size: 30px;
color: white;
text-align: center;
letter-spacing: 0.1em;
-webkit-text-stroke: 1px white;
text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
font-family: 'IM Fell Double Pica', serif;
}
<div class=" ui centered grid">
<div id="pictures" class="ui containcer">
<h1 id="line1">Service - Awareness - Commnuity Outreach</h1>
<img id="logo" src="https://image.ibb.co/bBHabb/slide.png">
<h1 id="line2">Sophomores Leaders Impacting, Developing, and Educating</h1>
</div>
</div>
So here is my question : How can I fix the responsiveness problem without having to use the background-url property (So just have img tags in myhtml)? And fyi I am using Semantic UI instead of Bootstrap.
First, I would like to mention that this would be a great use of css grid. But to answer your question and to pick up from what you have started. In order to make your images responsive without using background you need them to have a width: 100% and a height: auto. I modified your code a bit to show this would work in your question. Notice I made a wraper class with the position of relative and an inner class with position of absolute. The inner class contains your text and can text-align: center here. Your text and logo will now be on top of the image and centered. You will need media queries to change your text size to fit within the image on smaller screens. If you want to vertically align your inner class you might want to check out this link: http://vanseodesign.com/css/vertical-centering/ for some more details.
.res-image {
width: 100%;
height: auto;
}
#logo {
width: 30%;
height: auto;
padding-top: 20px;
}
#line1 {
font-size: 30px;
color: white;
padding-top: 40px;
margin-bottom: 4%;
letter-spacing: 0.1em;
-webkit-text-stroke: 1px white;
text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px
1px 0 #000, 1px 1px 0 #000;
font-family: 'IM Fell Double Pica', serif;
}
#line2 {
font-size: 30px;
color: white;
letter-spacing: 0.1em;
-webkit-text-stroke: 1px white;
}
<div class="wrapper ui centered grid">
<img class="res-image" src="https://image.ibb.co/gjfJAR/DSC_0041.jpg">
<div class="inner ui containcer">
<h1 id="line1">Service - Awareness - Commnuity Outreach</h1>
<img id="logo" src="https://image.ibb.co/bBHabb/slide.png">
<h1 id="line2">Sophomores Leaders Impacting, Developing, and
Educating</h1>
</div>
</div>

Text with outline and text shadow

I want to create following font style. If not possible I want to be as close to this style as possible. I need to support IE so I cannot use text-stroke.
The closest way I have come is to use multiple text-shadow attributes, for example:
h1 {
color: #2e536f;
font-weight: bold;
font-family: sans-serif;
font-size: 7em;
text-transform: uppercase;
text-shadow:
-1px -1px 0 #fff,
1px -1px 0 #fff,
-1px 1px 0 #fff,
1px 1px 0 #fff,
-2px -5px 0px #ff7c7c;
}
body {
background: #2e536f;
}
<h1>Zwei</h1>
While it does several tasks, I cannot make the color transparent, to reveal the text shadow behind it.
How can I solve this?
If you need to support IE, your best bet is to go for SVG. You can easily give stroke and/or shadow to text to make the exact style you are looking for. This can fit titles but might be a hassle for text that spans several lines though.
Here is your example with an inline SVG:
body {
background: #2e536f;
}
svg {
font-weight: bold;
font-family: sans-serif;
}
<svg viewbox="0 0 10 3">
<text font-size="3" x="1.5" y="2.5" dx="0" dy="0" fill="#FF7C7C">ZWEI</text>
<text font-size="3" x="1.5" y="2.5" dx="0.1" dy="0.15" fill="transparent" stroke="#fff" stroke-width="0.08">ZWEI</text>
</svg>
Note that using SVG (even for titles) doesn't impact SEO and google indexes SVG since 2010
body {
background: #2e536f;
}
h1 {
color: #2e536f;
font-weight: bold;
font-family: sans-serif;
font-size: 7em;
text-transform: uppercase;
text-shadow:
-1px -1px 0 #fff, 1px -1px 0 #fff, 1px 1px 0 #fff, 1px 1px 0 #fff, 2px -5px 0px #ff7c7c
}
<h1>Zwei</h1>
Can this be close to your expected output?

Inset box shadow doesn't work

I am trying to get an inside shadow working on an input field in Chrome. Unfortunately, this doesn't really work out so far. You can view a jsfiddle over here: http://jsfiddle.net/XgsPT/2/
My CSS:
input {
margin-top: 15px;
margin-left: 15px;
-moz-box-shadow: inset 0 0 10px #000000;
-webkit-box-shadow: inset 0 0 10px #000000;
box-shadow: inset 0 0 10px #000000;
}
And this simple HTML:
<input type="text" width="30">
But no shadow appears... (Chrome 24)
Give border to input field and the box-shadow will finally work.
http://jsfiddle.net/Jx8xF/
input {
margin-top: 15px;
margin-left: 15px;
-moz-box-shadow: inset 0 0 10px #aaa;
-webkit-box-shadow: inset 0 0 10px #aaa;
box-shadow: inset 0 0 10px #aaa;
border: 1px solid #aaa;
}
The background color of the input is messing things up. Check out this updated fiddle, with this change to the CSS:
input {
/* ... rest as before ...*/
background-color: transparent;
}
Basically, WebKit doesn't allow us to add box-shadow to form controls with native appearance. We need to remove the nativa appearance.
input {
-webkit-appearance: none;
box-shadow: inset 0 0 10px #000000;
}
Also, some CSS properties such as border and background imply -webkit-appearance:none.
Rather than setting the background to transparent set it to white, or whatever colour you like, you just need to declare it and then it will work as it should