So basically what im aiming to do is this:
However, i am not able to make the arrow (as img) show on top of div. Also i would appreciate if some1 could advice how to center the arrow vertically and horizontally.
Here is what i got:
section.main{
background-image: url(images/main.png);
overflow: auto;
padding: 290px 0px;
max-width: 1920px;
position: relative;
div{
height: 83px;
width: 83px;
background-color: #fff;
opacity: 0.5;
line-height: 83px;
vertical-align: middle;
text-align: center;
}
img.arr{
z-index: 100;
}
div.btnLeft{
float: left;
}
div.btnRight{
float: right;
}
p{
font-family: 'Playfair Display', sans-serif;
font-style: italic;
color: #fff;
font-size: 32px;
position: absolute;
top: 316px;
left: 375px;
}
<section class="main">
<p>Laisve kurti ir veikti!</p>
<div class="btnLeft">
<img class="arr" src="images/al.png">
</div>
<div class="btnRight">
<img class="arr" src="images/ar.png">
</div>
</section>
Thanks!
You can do that without any images, using a pseudo
section.main {
background-image: url(images/main.png);
overflow: auto;
padding: 90px 0px;
max-width: 1920px;
position: relative;
}
div {
position: relative;
height: 83px;
width: 83px;
background-color: lightgray;
opacity: 0.5;
}
div::after {
content: '>';
font-weight: bold;
font-size: 60px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
div.btnLeft::after {
content: '<';
}
div.btnLeft {
float: left;
}
div.btnRight {
float: right;
}
p {
font-family: 'Playfair Display', sans-serif;
font-style: italic;
color: #fff;
font-size: 32px;
position: absolute;
top: 316px;
left: 375px;
}
<section class="main">
<p>Laisve kurti ir veikti!</p>
<div class="btnLeft">
</div>
<div class="btnRight">
</div>
</section>
If you still want the images, add them like this
div::after {
content: url(images/ar.png);
}
div.btnLeft::after {
content: url(images/al.png);
}
Related
Im making a pricing page for my website but as I'm making my website responsive, (only when the page is less than 110 pixels wide),
* {
margin: 0;
padding: 0;
font-family: "Poppins", sans-serif;
}
#pricing {
height: 95vh;
width: 100vw;
background-color: #E5EDFB;
margin-top: none;
}
h1 {
color: #0E0A24;
padding-left: 8.75%;
padding-top: 5vh;
font-size: 300%;
}
h2 {
color: #0E0A24;
text-align: center;
margin-top: 4vh;
font-weight: 600;
font-size: 175%;
}
p {
color: #0E0A24;
text-align: center;
font-weight: 300;
}
span {
font-size: 120%;
font-weight: 400;
}
.smallTile {
background-color: white;
width: 23vw;
height: 65%;
border-radius: 15px;
}
.largeTile {
background-color: white;
width: 28vw;
height: 70%;
border-radius: 15px;
}
#photo {
margin-left: 8.75%;
position: relative;
top: 27%;
transform: translateY(-27%);
float: left;
}
#video {
margin-right: 8.75%;
position: relative;
top: 27%;
transform: translateY(-27%);
float: right;
}
#combo {
margin-right: 8.75%;
position: absolute;
left: 50%;
top: 60%;
transform: translate(-50%, -60%);
}
hr {
margin-top: 6%;
margin-bottom: 6%;
width: 20%;
position: relative;
left: 50%;
transform: translateX(-50%);
background-color: #0E0A24;
border: none;
height: 0.1px;
;
}
.topHR {
width: 50%;
margin-top: 4vh;
margin-bottom: 4vh;
height: 2px;
border-radius: 1px;
;
}
#comboHeader {
font-weight: 900;
font-size: 200%;
}
#media screen and (max-width: 1100px) {
body {
background-color: red;
}
.smallTile {
display: block;
position: relative;
width: 86vw;
height: 95vh;
}
.largeTile {
display: block;
position: relative;
width: 86vw;
}
#photo {}
#video {
margin-top: 100vh;
}
#combo {
margin-top: 100vh;
position: relative;
}
h1 {
margin-bottom: 20px;
}
}
<div id=p ricing>
<h1>Our Pricing:</h1>
<div class="smallTile" id="photo">
<h2>Photography<br>Plan</h2>
<hr class="topHR">
<p><span>0 - 10 Pictures</span><br>$100</p>
<hr>
<p><span>10 - 20 Pictures</span><br>$175</p>
<hr>
<p><span>20+ Pictures</span><br>$250</p>
</div>
<div class="smallTile" id="video">
<h2>Videography<br>Plan</h2>
<hr class="topHR">
<p><span>0 - 5 Videos</span><br>$100</p>
<hr>
<p><span>5 - 10 Videos</span><br>$150</p>
<hr>
<p><span>Edited Video</span><br>Additional $50</p>
</div>
<div class="largeTile" id="combo">
<h2 id="comboHeader">Combo<br>Plan</h2>
<hr class="topHR">
<p><span>Combined price of both plans</span><br>$50 Reduced</p>
<hr>
</div>
</div>
I noticed that the combo package text is at the bottom of the page instead of in the div where I placed it. Additionally, is it possible to change the order of the divs so that the combo package is last on the responsive site only? Thanks for your help in advance!
I noticed you did not specify the float value for the combo div. Add float to the combo styles as such:
#combo{
margin-right: 8.75%;
position: absolute;
left: 50%;
top: 60%;
transform: translate(-50%, -60%);
float: left;
}
I created a rectangle with a position: relative; and positioned an icon inside. But when I create a new div class called .Home and give it a <h4>Home</h4> element with position: relative; it position the element outside of the rectangle. What am I doing wrong?
I tried changing the position value but it doesn't work.
.container {
height: 100%;
width: 100%;
margin: auto;
display: table;
top: 0;
background-size: cover;
position: static;
}
.Rec {
width: 97px;
height: 812px;
left: 0px;
top: 0px;
background: #FFFFFF;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.5);
position: relative;
}
.icons {
position: relative;
width: 38px;
height: 48px;
left: 30px;
top: 29px;
}
.fa-bars {
color: black;
font-size: 30px;
}
.Home {
width: 65px;
height: 29px;
left: 34px;
top: 217px;
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
line-height: normal;
font-size: 20px;
text-align: center;
transform: rotate(-90deg);
color: black;
position: relative
}
<div class="container">
<div class="Rec">
<div class="icons"><i class="fas fa-bars"></i>
<div class="home">
<h3>Home</h3>
</div>
</div>
</div>
</div>
You don't need parent div to be position:relative. Check out the Codepen.
<div class="container">
<div class="Rec">
<div class="icons">
<i class="fas fa-bars"></i>
<div class="home">
<h3>Home</h3>
</div>
</div>
</div>
</div>
CSS
.container {
height: 100%;
width: 100%;
margin: auto;
display: table;
top: 0;
background-size: cover;
position: static;
}
.Rec {
width: 97px;
height: 812px;
left: 0px;
top: 0px;
background: #FFFFFF;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.5);
position: relative;
}
.icons {
width: 38px;
height: 48px;
left: 30px;
top: 29px;
}
.fa-bars {
color: black;
font-size: 30px;
}
.home {
width: 65px;
height: 29px;
left: 34px;
top: 217px;
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
line-height: normal;
font-size: 20px;
text-align: center;
transform: rotate(-90deg);
color: black;
position: relative;
}
Is this what you want?
I'm working with partial sections. Here I want to use the only one span to the text in the middle of the two sections. The text center of the two sections will have both colors white and block. According to my code, I have taken in two different section and I use text gradient color. But I don't want is there any possibilities using jquery. Can anyone help me?
.wrapper img {
width: 100%;
position: relative;
}
.section {
position: absolute;
top: 20%;
right: 0;
left: 0;
margin: 0 auto;
width: 1200px;
box-shadow: 9px 7px 30px 0px rgba(0,0,0,0.75);
}
.ad-image {
width: 100%;
height: 700px;
background-image: url('https://preview.ibb.co/e8NhxK/ad.jpg');
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.ad-image-content h2 {
position: absolute;
top: 198px;
right: 32px;
font-size: 42px;
font-weight: 500;
color: #fff;
}
.ad-portfolio {
background-color: #ffffff;
}
.ad-portfolio .menu ul {
display: flex;
justify-content: flex-end;
list-style-type: none;
color: #808080;
}
.ad-portfolio .menu ul li {
margin: 5px 10px;
font-family: 'Ubuntu', sans-serif;
font-size: 18px;
font-weight: 500;
}
.ad-content {
width: 139%;
position: absolute;
left: 6%;
top: 28%;
color: #000;
}
.ad-content h3 {
font-size: 14px;
letter-spacing: 5px;
}
.ad-content span,
.ad-content h2 {
font-size: 42px;
font-weight: 500;
text-indent: 2px;
}
.ad-content span {
position: absolute;
left: -45px;
top: -4px;
font-size: 42px;
background: linear-gradient(to right, #ffffff 46%, #000000 47%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.ad-count {
position: absolute;
top: 50%;
right: 4%;
}
span.read {
display: block;
position: absolute;
top: 90%;
left: 35%;
font-size: 24px;
font-weight: 500;
color: #6f6f6f;
}
span.read:after {
content: '';
position: absolute;
left: -240%;
top: 55%;
width: 0;
height: 3px;
transition: .5s all linear;
}
span.read:hover::after {
left: -240%;
width: 280px;
height: 1px;
background-color: #1F1F1F;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="wrapper container-fuild">
<div class="container section">
<div class="row">
<div class="col-md-7 ad-image">
<div class="ad-image-block">
</div>
<div class="ad-image-content">
<h2>White</h2>
</div>
</div>
<div class="col-md-5 ad-portfolio">
<div class="menu">
<ul>
<li>Home</li>
<li>Stories</li>
<li>Publications</li>
<li>Contact Us</li>
</ul>
</div>
<div class="ad-content">
<span>&</span>
<h2>Black</h2>
</div>
<div class="ad-count">
<span>01</span>
<hr>
<span>07</span>
</div>
<span class="read">Read more</span>
</div>
</div>
</div>
</div>
You can easily style a single span of text with two colours by using a single CSS Pseudo Element with a higher z-index, and some text-indent.
.bw {
position: relative;
font-size: 30px;
background: #ccc;
font-family: 'Ubuntu', sans-serif;
color: #fff;
}
.bw:after {
content: "& Black";
display: inline;
position: absolute;
top: 0;
right: 0;
color: black;
z-index: 1;
overflow: hidden;
text-indent: -0.3em;
}
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<span class="bw">White & Black</span>
Problem Statement : Center alignment not happening
Relevant code:
#tekst {
font-family: 'Roboto', sans-serif;
font-size: 14px;
color: #EFEFEF;
width: 100%;
height: 30%;
}
#innhold {
width: 100%;
height: 30%;
top: 18%;
left: 0%;
background-color: #7e7e7e;
position: absolute;
border-radius: 5px;
z-index: 2;
}
<div id="innhold">
<div id="tekst"> text </div>
</div>
any help would be appreciated.
You can use text-align:center; to center text.
#tekst {
font-family: 'Roboto', sans-serif;
font-size: 14px;
color: #EFEFEF;
width: 100%;
height: 30%;
text-align: center;
}
#innhold {
width: 100%;
height: 30%;
top: 18%;
left: 0%;
background-color: #7e7e7e;
position: absolute;
border-radius: 5px;
z-index: 2;
}
<div id="innhold">
<div id="tekst"> text </div>
</div>
To fully center your text you can use flexbox:
#tekst {
font-family: 'Roboto', sans-serif;
font-size: 14px;
color: #EFEFEF;
height: 30%;
}
#innhold {
width: 100%;
height: 30%;
top: 18%;
left: 0%;
background-color: #7e7e7e;
position: absolute;
border-radius: 5px;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
}
<div id="innhold">
<div id="tekst"> text </div>
</div>
You need to add the CSS property text-align:center;.
Hope this helps.
#tekst {
font-family: 'Roboto', sans-serif;
font-size: 14px;
text-align:center;
color: #EFEFEF;
width: 100%;
height: 30%;
}
#innhold {
width: 100%;
height: 30%;
top: 18%;
left: 0%;
background-color: #7e7e7e;
position: absolute;
border-radius: 5px;
z-index: 2;
}
<div id="innhold">
<div id="tekst"> text </div>
</div>
Quick question, I need help and have no idea what to do, because I know nothing about html/css and got this as a bonus task along with other programming things.
What I have:
What I would like to have:
Here is css code
.offer-small { width: 278px; height: 209px; position: relative; margin-bottom: 25px; }
.offer-small img { width: 278px; height: 209px; }
.offer-small .mask { width: 278px; height: 209px; cursor: pointer; position: absolute; top: 0; left: 0; background: url('../images/photo-small-mask.png'); }
.offer-small .desc { display: none; font-size: 10pt; width: 258px; height: 189px; padding: 10px; position: absolute; top: 0; left: 0; background: url('../images/photo-small-black-transparent.png'); color: white; text-shadow: 1px 1px #000000}
.offer-small .desc p { font-size: 9pt; color: #f2f0e4; }
.offer-small .desc table.compare { width: 160px; height: 48px; margin: 0 auto 0 auto; background: url('../images/offer-table.png'); color: #f2f0e4; }
.offer-small .desc table td { text-align: center; padding-bottom: 10px; }
.offer-small .desc table td.small { font-size: 8pt; }
.offer-small .title { width: 258px; background: url('../images/offer-transparent.png'); padding: 2px 10px; position: absolute; top: 120px; left: 0; }
.offer-small .title strong { font-size: 9pt; color: #ffffff; }
.offer-small .title small { font-size: 8pt; color: #f2f0e4; }
.offer-small .title small strong { font-size: 8pt; color: #f2f0e4; }
.offer-small .view-offer { position: absolute; top: 160px; left: 150px; }
.view-offer { display: block; width: 120px; height: 44px; background: url('../images/button-view-offer.png'); }
.btnSendOrder { width: 260px; height: 75px; border: 0; background: url('../images/button-send-order.png'); cursor: pointer; }
.toLeft { float: left; margin-right: 25px; }
Html/smarty code:
{if $random}{foreach item=item from=$random}
<div class="offer-small">
<img src="{$smarty.const.APP_URL}/userfiles/photos/{if $item.item_photo}s_{$item.item_photo}{else}blank_small.jpg{/if}" alt="" />
<div class="desc">
<strong>{$item.item_name|truncate:30}</strong>
<p>{$item.item_short_description|truncate:120}</p>
<p align="right"></p>
</div>
<div class="title">
<strong>{$item.item_name|truncate:30}</strong><br/><small>Cena teraz: <strong>{$item.item_cost_now|money} zł</strong> zamiast <strong>{$item.item_cost_before|money} zł</strong></small><br/><br/>
<strong>OSZCZĘDZASZ <big>{$item.item_cost_before-$item.item_cost_now|money}</big> zł</strong>
</div>
</div>
{/foreach}{/if}
Tips are welcome too.
I mean I can handle making grid if someone will show me how to break this stupid list.
An easy way is to just float the divs of class .offer-small left:
.offer-small {
width: 278px;
height: 209px;
position: relative;
margin-bottom: 25px;
float:left;
}
As long as you have them all within a container element with a fixed width, they should fit next to each other nicely, wrapping to the next line automatically.