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>
Related
This question already has answers here:
Curved end of border-bottom in CSS
(4 answers)
Closed 1 year ago.
I am trying to create rounded corner for border bottom. For example I have a text with underline this underlines should look like rounded corners. I don't want to use Images so I am trying to create via css
Here is my CSS code
.footer_line {
white-space: nowrap;
margin-top: 12px;
font-weight: bold;
border-bottom: 4px solid #2782dd;
padding-bottom: 1px;
font-size: 36px;
width: 150px;
border-radius: 4px !important;
}
.news_let {
margin-left: 0px !important;
margin-top: 37px !important;
font-weight: bold !important;
letter-spacing: 1px !important;
color: white !important;
font-size: 21px !important;
border-bottom: 2px solid #2782dd !important;
padding-bottom: 6px !important;
}
Here is my HTML Code
<div class="col-md-6">
<h3 class="news_let footer_line">News Letter</h3><br/>
</div>
in Current scneario rounded corner not coming as rounded corner please see the reference here
It should look like
Here you go. You need to add a div and give it a border-bottom. I have changed the HTML and CSS below. You can increase the div's height and width as you like
.footer_line {
white-space: nowrap;
margin-top: 12px;
font-weight: bold;
padding-bottom: 1px;
font-size: 36px;
width: 150px;
border-radius: 4px !important;
}
.news_let {
margin-left: 0px !important;
font-weight: bold !important;
letter-spacing: 1px !important;
color: white !important;
font-size: 21px !important;
border-bottom: 4px solid #2782dd !important;
border-radius:4px;
}
<div class="col-md-6">
<h3 class="footer_line">News Letter
<div class="news_let"></div>
</h3><br/>
</div>
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>
I have my timer that has date/hour/minute/seconds and the only one that doesn't align is the seconds. I tried many things such as different ways to align. So how can I align all the timer's items.
Can someone help me?
HTML
<div class="jumbotron timer">
<h2>Time until the tracker is activated</h2>
<div class="timertxtc">
<div class="timertxt" id="daysBox"></div>
<h4>Days</h4>
</div>
<h3 class="space">1</h3>
<div class="timertxtc">
<div class="timertxt" id="hoursBox"></div>
<h4>Hours</h4>
</div>
<h3 class="space">1</h3>
<div class="timertxtc">
<div class="timertxt" id="minsBox"></div>
<h4>Minutes</h4>
</div>
<h3 class="space">1</h3>
<div class="timertxtc">
<div class="timertxt" id="secsBox"></div>
<h4>Seconds</h4>
</div>
<script>cdtd();</script>
</div>
CSS
body {
margin: 0;
padding: 0;
background-image: repeating-linear-gradient(
90deg,
#FFFFFF,
#FFFFFF 18px,
#CA1D20 0px,
#CA1D20 28px
);
}
h1{
font-size: 64px;
text-align: center;
color: #3498db;
text-shadow: 3px 3px 0px #000;
}
h2{
font-size: 32px;
text-align: center;
color: #3498db;
text-shadow: 3px 3px 0px #000;
margin: auto;
}
.jumbotron.timer{
width: 48%;
height: 360px;
margin: auto;
background-color: #669900;
}
.timertxt{
color: #3498db;
text-shadow: 3px 3px 0px #000;
font-size: 64px;
padding-left: 12px;
padding-right: 12px;
border: 2px solid #2980b9 ;
border-radius: 5px;
background-color: #2980b9;
text-align: center;
}
.space{
font-size: 12px;
display: inline-block;
float: left;
visibility: hidden;
}
.timertxtc{
width: 25%;
height: 120px;
float: left;
display: inline-block;
margin: auto;
}
h4{
font-size: 32px;
color: #3498db;
text-shadow: 3px 3px 0px #000;
display: inline-block;
text-align: center;
}
The character in your <h3 class="space">1</h3> elements was causing the content of the container div to exceed 100% pushing 'seconds' on to the next line.
See fixes in the following fiddle:
https://jsfiddle.net/oLncm9d2/4/
Instead of using an element for 'spacing' padding-right / padding-left in combination with box-sizing: border-box; can achieve the spacing you want, without disrupting width calculations. (The solution demonstrates this and has removed the <h3 class="space">1</h3> elements.)
Note: I increased the container width to prevent excessive overlap for demonstration.
i want create with revolution slider verson jquery a slider, in this slider i want compare a banner with test + background text color :
if you notice the text is not center-aligned vertically
but i don't understant because in tablet and mozilla the view is good(the text is allineate x=center , y=center), while on chrome and safari not see them lined up.
i test also to change css but the result is inverse good with safari and chrome and bad with mozilla.
this is a simple code of slider
<ul>
<li data-transition="turnoff" data-slotamount="1" data-masterspeed="600"><img alt="lightsplash24" src="{{media url="wysiwyg/trego/homepage_slider/slider5/dummy.png"}}" data-lazyload="{{media url="wysiwyg/AA-lecolart-slider-last.jpg"}}" />
<div class="tp-caption modern_small_text_dark randomrotate" data-speed="600" data-x="center" data-y="center" data-start="1400" data-easing="easeOutExpo">
<div class="morius">THIS IS A TEXT OF BANNER</div>
</div>
</li>
<ul>
1 ) I USED before this css( with this, the result is good for mozialla but bad for chrome
#font-face {
font-family: font-one;
src: url(../fonts/Bellerose.ttf); /* check this */
}
.tp-caption.modern_small_text_dark{
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 130px;
overflow: hidden;
border: none;
font: normal 53px/1 "font-one", Times, serif;
padding: 20px;
color: rgba(255,255,255,1);
text-align: center;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
background: #111111;
-webkit-box-shadow: 1px 1px 1px 0 rgba(0,0,0,0.3) ;
box-shadow: 1px 1px 1px 0 rgba(0,0,0,0.3) ;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2) ;
vertical-align: middle;}
2) i used also this css (with this is good on chrome but bad in safari)
#font-face {
font-family: font-one;
src: url(../fonts/Bellerose.ttf); /* check this */
}
.morius {
font-family: font-one;
position: relative;
top: 50%;
transform: translateY(-50%);
background: black;
font-size: 53px!important;
height: 100px;
line-height: 120%;
padding-bottom: 15px;
}
how do I get a unique code that works on all browsers to have aligned text in the box black ??
as shown in this image
Firstly remove the height. Because revolution slider will put your div's height.
Fixed your height by Padding.
No need to use overflow hidden.
No need to text align center.
.tp-caption.modern_small_text_dark{
border: none;
font: normal 53px/1 "font-one", Times, serif;
padding: 40px 20px;
color: rgba(255,255,255,1);
background: #111111;
-webkit-box-shadow: 1px 1px 1px 0 rgba(0,0,0,0.3) ;
box-shadow: 1px 1px 1px 0 rgba(0,0,0,0.3) ;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2) ;
}
I´m trying to do some buttons with image and text, and I already did this work.
But now I´m studying a diferente hypothesis, If I have a text bigger I´m trying to center the text in the button but I´m not having sucess put this right. I´m not having succeess putting my very big is not good align-center just below the 1st text.
Have you ever had a case like this? How we can solve this?
I have this Html for two buttons:
<button class='btn'>
<img class="big_btn" src="icon1.png" width="40" height="40"/>
Big button so big <span> very big is not good</span>
</button>
<button class='btn'>
<img src="icon1.png" width="40" height="40">
2button big
</button>
And I have this css file:
.btn {
position: relative;
width: 180px;
height: 60px;
margin-top:7%;
padding: 0 10px 0 10px;
line-height: 37px;
text-align: left;
text-indent: 10px;
font-family: 'bariol_regularregular';
font-size: 15px;
color: #333;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
background: #f1f1f1; /* button background */
border: 0;
border-bottom: 2px solid #999; /* newsletter button shadow */
border-radius: 14px;
cursor: pointer;
-webkit-box-shadow: inset 0 -2px #999;
box-shadow: inset 0 -2px #999;
}
.btn:active {
top: 1px;
outline: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn img { float: left;}
.btn .big { margin-top:10px;}
.btn:hover { background-color: #f7f7f7;}
Here's the Fiddle: http://jsfiddle.net/3F9pu/
My image updated:
Your problem is your line-height attribute. If you set that to be 37px, each new line of text will be separated by 37px. Remove `line-height:37px and the text will wrap around the image.
line-height: 37px
I also removed your text-indent and replaced it with a margin on your floated image to make the text all align properly.
.btn img{
float:left;
margin-right: 10px;
}
text-indent: 10px
JSFiddle
Use a CSS background image.
Have a fiddle - Fiddle Link!
HTML
<button class='btn'>Big button so big very big is not good</button>
<button class='btn'>2button big</button>
CSS
.btn {
background: url("http://lorempixel.com/output/cats-q-c-40-40-3.jpg") #CCC 10px no-repeat;
border: none;
padding: 10px 10px 10px 60px;
width: 200px;
text-align: left;
vertical-align: top;
min-height: 60px;
cursor: pointer;
}
.btn:hover {
background-color: #F00;
}