I need to add a custom looking slider to website made on Elementor.
The website itself
I didn't make it from the start, I just have to fix slider. Not that one from premium features - it has to look different.
I added the custom post type called 'slider', and use it for a loop, like I always do without elementor.
// Shortcode to output custom PHP in Elementor
function wpc_elementor_shortcode( $atts ) {?>
<section class="slider-section">
<div class="slider-section-inner">
<div class="slider-item-wrapper">
<?php
global $post;
$args = array( 'numberposts' => -1, 'post_type' => 'slider');
$myposts = get_posts( $args );
foreach($myposts as $post){ setup_postdata($post); ?>
<div class="slider-item">
<div class="slider-item-inner d-flex">
<div class="slider-item-img">
<?php the_post_thumbnail()?>
</div>
<div class="slider-item-text">
<h2 class="elementor-heading-title elementor-size-default">
<?php the_title()?>
</h2>
<div class="d-flex">
<span class="jet-headline__label">
<?php the_excerpt()?>
</span>
<div class="content-button">
<?php the_content()?>
</div>
</div>
</div>
</div>
</div>
<?php
}
wp_reset_postdata();
?>
</div>
</div>
</section>
<?php }
add_shortcode( 'my_elementor_php_output', 'wpc_elementor_shortcode');
Added its loop to the shortcode, pasted the shortcode to the text block, and one item appears correctly, but something wrong with the slick.
Then added the script to functions.php
add_action('wp_footer','slider_main');
function slider_main(){?>
<script>
jQuery(document).ready(function(){
jQuery('section.slider-section .content-button a').addClass('raven-button raven-button-link elementor-animation-grow');
jQuery('.slider-item-wrapper').each(function() {
var slider = jQuery(this);
slider.slick({
slidesToShow: 1,
slidesToScroll: 1,
dots:false,
arrows: true,
});
});
});
</script>
<?php }
It's fully white, I don't see it.
I experemented to change containers and wrappers, but it's still something wrong. Please help - maybe I miss something.
Is it a script or maybe a style?
section.slider-section {
width: 100%;
display: flex;
justify-content: center;
margin-top: 90px;
margin-bottom: 200px;
overflow-x:hidden
}
.slider-item-inner.d-flex {
display: flex;
align-items: center;
}
.slider-item-img {
width: 50%;
}
.slider-item-img img {
height: auto;
max-width: 100%;
}
.slider-item-text {
width: 50%;
}
section.slider-section h2.elementor-heading-title.elementor-size-default {
color: #000000;
font-family: "Alef", Sans-serif;
font-size: 120px;
font-weight: 600;
line-height: 83px;
margin-right:50px
}
.slider-section-inner{
max-width:1140px;
}
section.slider-section .slick-track{
display:flex!important;
justify-content:center;
}
section.slider-section span.jet-headline__label {
color: #000000;
font-family: "Alef", Sans-serif;
font-size: 35px;
font-weight: 400;
}
span.jet-headline__label p {
padding: 10px 0px 10px 0px;
border-style: solid;
border-width: 0px 0px 10px 0px;
border-color: #E1FF25;
}
.slider-item-text p {
display: flex;
width: fit-content;
}
.slider-item-text .d-flex {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
max-width: 24vw;
margin-right:50px
}
.content-button a {
padding: 15px 15px 15px 15px;
background-color: #E1FF25;
background-image: none;
border-color: #000000;
border-style: solid;
border-width: 0px 0px 0px 0px;
border-radius: 0px 0px 0px 0px;
font-family: "Alef", Sans-serif;
font-size: 25px;
font-weight: 800;
color: #000000;
}
.raven-button:focus, .raven-button:hover, .raven-button:visited, a.raven-button:focus, a.raven-button:hover, a.raven-button:visited{
color:unset!important;
text-decoration:none!important
}
Related
I am doing this website for my full stack web development course but I am having a bit of trouble with my css. I am wondering how I can get the text Div to scale with the page.
the div looks like this zoomed in,
and it looks like this zoomed out,
the text div always wants to stay the same size.
the css is
.waitingMainDiv {
width: 70%;
display: flex;
justify-content: center;
align-items: center;
margin: auto;
padding-top: 80px;
padding-bottom: 80px;
}
.waitingLeftDiv {
width: 100%;
height: auto;
}
.waitingLeftDivImage {
width: 100%;
height: auto;
}
.waitingRightDiv {
width: 100%;
height: auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.waitingTextDiv {
width: 85%;
color: grey;
}
.waitingTextDiv h2 {
font-family: nunito;
font-weight: 700;
font-size: 2.3em;
margin: 4%;
}
.waitingTextDiv h3 {
font-family: nunito;
margin: 30px;
}
.waitingTextDiv p {
font-family: nunito;
margin: 30px;
font-size: 1.2em;
}
.waitingButtonDiv {
display: flex;
justify-content: flex-start;
width: 85%;
margin-left: 50px;
}
.waitingButtonDiv button {
width: 180px;
border-radius: 8px;
box-shadow: 0px 2px 5px rgb(0, 0, 0, 0.4);
font-family: nunito;
font-weight: 800;
}
.waitingEnquireButton {
border: 2px solid #43c0f6;
background-color: white;
color: #707070;
margin-right: 100px;
}
.waitingSignUpButton {
border: 2px solid #f91c85;
background-color: #f91c85;
color: white;
}
and the react.js is
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js">
import teacherPicture from "../../../../img/teacherPicture.png";
import React, { useState } from "react";
import "./Waiting.css";
import NavModal from "../../../Nav/NavModal";
export default function Waiting() {
const [open, setOpen] = useState(false);
const handleOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
return (
<div className="waitingMainContainer">
<div className="waitingMainDiv">
<div className="waitingLeftDiv">
<img className="waitingLeftDivImage" src={teacherPicture} alt="" />
</div>
<div className="waitingRightDiv">
<div className="waitingTextDiv">
<h2>What are you waiting for?</h2>
<h3>Start teaching Digital Technologies today.</h3>
<p>
If you need more information, we are happy to answer any questions
you may have.
</p>
</div>
<div className="waitingButtonDiv">
<button className="waitingEnquireButton">ENQUIRE NOW</button>
<button
onClick={() => handleOpen()}
className="waitingSignUpButton"
>
SIGN UP
</button>
<NavModal open={open} handleClose={handleClose} />
</div>
</div>
</div>
</div>
);
}
</script>
Thankyou to those who review my code, its definitely a simple fix but im driving myself crazy over it.
Give your main div a width, not %;
.waitingMainDiv {
width: 70vw; //changed
display: flex;
justify-content: center;
align-items: center;
margin: auto;
padding-top: 80px;
padding-bottom: 80px;
}
I have noticed the problem of certain letters overflowing their container on the left side, but I haven't seen anyone actually bringing up the problem.
I've tried between a few different font-families, but they all seem to have the same problem.
JSFIDDLE: https://jsfiddle.net/3h5poynt/
HTML (angular)
<div class="personal-profile container-column">
<mat-card class="header">
<section class="cover-section"></section>
<section class="intro-section">
<div class="intro-header">
<div class="profile-photo-wrapper">
<img src="/assets/img/profile-picture-placeholder.png" alt="" class="profile-photo" />
</div>
<div class="badges-container">
<ul class="badges-list">
<li>
<img
src="/assets/badges/business-plans-180x180.png"
alt="Business plan"
matTooltip="Something"
matTooltipClass="badge-tooltip"
matTooltipPosition="above"
/>
</li>
<li><img src="/assets/badges/calling-customers-180x180.png" alt="Calling customers" /></li>
<li><img src="/assets/badges/finance-180x180.png" alt="Finance" /></li>
<li>
<img src="/assets/badges/selling-to-customers-180x180.png" alt="Selling to customers" />
</li>
<li><img src="/assets/badges/social-media-180x180.png" alt="Social media" /></li>
</ul>
</div>
</div>
<div class="info-container">
<div class="personal-info">
<div class="name-text">{{ profile ? profile.name : '' }}</div>
<div class="description">{{ profile ? profile.personal_description : '' }}</div>
</div>
<div class="additional-info"></div>
</div>
</section>
</mat-card>
SCSS
#import '../../../variables';
.mat-card {
padding: 0;
overflow: hidden;
section {
padding: 20px;
}
}
.badge-tooltip {
background: #3f51b5;
color: white;
font-family: $font-open-sans;
}
.personal-profile {
margin-top: 50px;
.header {
min-height: 500px;
width: 100%;
.cover-section {
background: url('/assets/img/coverpicture.png') center/cover;
height: 225px;
}
.intro-section {
.intro-header {
size: auto;
.profile-photo-wrapper {
position: relative;
margin-top: -87px;
display: inline-block;
.profile-photo {
width: 150px;
height: 150px;
border: 4px solid white;
border-radius: 10px;
box-shadow: inset 0 1.5px 3px 0 rgba(0, 0, 0, 0.15), 0 1.5px 3px 0 rgba(0, 0, 0, 0.15);
background-color: #fff;
}
}
.badges-container {
vertical-align: middle;
display: inline-block;
margin-top: -87px;
.badges-list {
list-style: none;
li {
float: left;
padding: 0 10px 0 10px;
img {
width: 40px;
height: 40px;
}
}
}
}
}
.info-container {
padding-top: 15px;
display: grid;
grid-template-columns: 1fr 1fr;
font-family: $font-open-sans;
.personal-info,
.additional-info {
display: flex;
flex-direction: column;
}
.personal-info {
.name-text {
font-size: 1.3em;
}
}
}
}
}
}
Main SCSS
/* You can add global styles to this file, and also import other style files */
#import '~#angular/material/prebuilt-themes/indigo-pink.css';
#import '_variables.scss';
* {
margin: 0;
padding: 0;
font-family: $font-open-sans;
}
html {
font-family: 'Roboto', sans-serif;
}
html,
body {
height: 100%;
width: 100%;
background-color: #e9ebee;
}
.container-column {
display: flex;
flex-direction: column;
width: 80%;
margin: auto;
}
.container-row {
display: flex;
flex-direction: row;
width: 80%;
margin: auto;
}
Is there something very essential that I am missing, or is this something that has to be hacked?
Jonas,
Some fonts are "just like that".
You will find that (especially with some of the more amateurish free fonts available nowadays) that some fonts' descenders, ascenders, ornaments, etc just overlap the borders that we (programmers, readers) expect them to conform to.
If you really want to use a font like this in this specific context, then you have to program around the font's limitations.
In your fiddle, I merely added padding-left to the name-text style:
.name-text{
font-size: 1.3em;
font-family: "Open Sans", sans-serif;
background: red;
padding-left:15px; /* voila! */
}
Give it a try in the fiddle.
If the left bearing is radically different on initial characters across the font, then you maybe able to set up various styles with padding that changes according to the substring value of the first character. Sounds like a bit of a living hell to program that, but if you really want it, there you go.
Or you could just pick a different font.
I have a problem with styling my bar, which works on flexbox.
bar
As you can see, there is three divs inside: one sticked to the left border and another sticked to right border; there is also a small div in the middle showing the amount of comments (80px) and I want it to go left and stick to the div on left. Is it a chance to manage this with flexbox, without changing for display: inline-block?
The bar has a class .article__metas.
The div in the middle is .social_item.
<div class="article__metas">
<div class="item date">
//showing date
</div>
<div class="seperator"></div>
<?php
/**
$clist = get_the_category_list(', ');
if (!empty($clist)) {
?>
<div class="item categories">
<?php
echo $clist;
?>
</div>
<div class="seperator separator-categories"></div>
<?php } */
?>
<?php
$share = $app->getPostStats();
if ($share->comment_count > 0 || $share->share_count > 0):?>
<div class="item social_item">
<?php
if ($share->comment_count > 0) {
echo '<span>';
echo '<img src="' . _img_url('comment.svg') . '"/>';
echo '<span class="amount">' . $share->comment_count . '</span>';
echo '</span>';
}
if ($share->share_count > 0) {
echo '<span>';
echo '<img src="' . _img_url('share.svg') . '"/>';
echo '<span class="amount">' . $share->share_count . '</span>';
echo '</span>';
}
?>
</div>
<?php endif; ?>
<?php get_template_part('inc/article/share'); ?>
</div>
And Sass:
.article__metas {
color: #888888;
font-size: 12px;
display: flex;
border-bottom: 1px solid #e5e5e5;
justify-content: space-between;
#include link-color('a', '#888');
a:hover {
text-decoration: underline;
}
.item {
padding: 20px;
&:first-child {
padding-left: $cards_left;
}
}
.seperator {
display: block;
align-self: stretch;
width: 1px;
background-color: #e5e5e5;
}
.social_item {
display: flex;
align-items: center;
justify-content: space-between;
span + span {
margin-left: 20px;
}
& > span {
display: block;
white-space: nowrap;
img {
width: 16px;
display: inline-block;
}
}
img {
margin-top: 2px;
margin-right: 9px;
}
}
}
Thank you in advance!
Please check if this is what you need. SCSS doesn't work here, so you need to copy to your own environment.
.ariticle__metas is now aligned left and .social_item has a margin-left:auto
Fiddle here
.article__metas {
color: #888888;
font-size: 12px;
display: flex;
border-bottom: 1px solid #e5e5e5;
justify-content: left;
#include link-color('a', '#888');
a:hover {
text-decoration: underline;
}
.item {
padding: 20px;
&:first-child {
padding-left: 10px;
}
}
.seperator {
display: block;
align-self: stretch;
width: 1px;
background-color: #e5e5e5;
}
.social_item {
display: flex;
align-items: center;
justify-content: space-between;
margin-left: auto;
span + span {
margin-left: 20px;
}
& > span {
display: block;
white-space: nowrap;
margin-right: 10px;
img {
width: 16px;
display: inline-block;
}
}
img {
margin-top: 2px;
margin-right: 9px;
}
}
}
<div class="article__metas">
<div class="item">Dodano 18.04.2016</div>
<div class="seperator"></div>
<div class="item">1</div>
<div class="seperator"></div>
<div class="social_item">
<span>Spodobal Ci</span>
<img src="http://placehold.it/15" />
<img src="http://placehold.it/15" />
<img src="http://placehold.it/15" />
<img src="http://placehold.it/15" />
</div>
</div>
Originally my CSS was working fine for this particular section but for some reason which I can't figure out my CSS isn't being processed into the browser yet all my other CSS from that style sheet is fine. I know there has to be an error but I'm not sure what, with a fresh set of eyes I hope can help me out.
This is what I see:
<div id="service-contact-wrap">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div id="service-contact">
<div class="service-contact-details">
<h3>Work With Me</h3>
<p>Please give me a call or use the contact form below</p>
<p class="service-contact-details-phone"> 000000 000000</p>
</div>
<?php echo do_shortcode("[contact-form-7 id='108' title='Contact form footer']"); ?>
</div>
</div>
</div>
</div>
/* Service Bottom Page Contact Form */
#service-contact-wrap {
width: 100%;
background-color: #005E86;
color: #fff;
margin-top: 20px;
margin-bottom: -15px;
margin-top: 15px;
}
#services-header {
font-size: 22px;
margin-top: 0px;
}
.service-contact-details {
text-align: center;
}
.service-contact-details h3 {
font-size: 2.5em;
margin-top: 54px;
}
.service-contact-details p {
color: #fff;
font-size: 16px;
}
.service-contact-details-phone {
font-size: 22px !important;
}
#service-contact {
padding-bottom: 20px;
}
.form-control {
max-width: 100%;
}
.service-contact-form-botton {
margin-right: auto;
margin-left: auto;
}
I'm having issue styling grid view for my product list page. What i want is to style it in a way that four products will be display on each row and with maximum of three rows per page. Currently, what i have is product displaying vertically. Any help?
My code for product.php is:
<?php
$result=mysql_query("select * from products") or die("select * from products"."<br/><br/>".mysql_error());
while($row=mysql_fetch_array($result)){
?>
<div id="product-grid">
<div class="product-item">
<div class="product-image"><img src="<?php echo $row['picture']?>" /></div>
<div><strong><?php echo $row['name']?></strong></div>
<div class="product-description"><?php echo $row['description']?></div>
Price:
<div class="product-price">$<?php echo $row['price']?></div>
<div><input type="button" value="Add to Cart" onclick="addtocart(<?php echo $row['serial']?>)" /></div>
<?php } ?>.
My style is something like this but its not having any desirable effect.
body{width:610px;}
#product-grid {border-top: #F08426 2px solid;margin-bottom:30px;}
#product-grid .txt-heading{background-color: #FFD0A6;}
.product-item { float:left; background:#F0F0F0; margin:15px; padding:5px;}
.product-price {color:#F08426;}
.product-image {height:100px;background-color:#FFF;}
Any help will be appreciated.
You can use flex
Checkout demo below
demo
#product-grid {
display: flex;
flex-wrap:wrap;
}
.product-item {
display: inline-block;
background: #ccc;
margin:10px 0 0 10px;
width: calc(100% * (1/4) - 12px - 1px)
}
close product-item div u just forgot to close product-item div that's why your css is not working.
<?php
$result=mysql_query("select * from products") or die("select * from products"."<br/><br/>".mysql_error());
while($row=mysql_fetch_array($result)){
?>
<div id="product-grid">
<div class="product-item">
<div class="product-image"><img src="<?php echo $row['picture']?>" /></div>
<div><strong><?php echo $row['name']?></strong></div>
<div class="product-description"> <?php echo $row['description']?> </div>
Price:
<div class="product-price">$ <?php echo $row['price']?> </div>
<div>
<input type="button" value="Add to Cart" onclick="addtocart(<?php echo $row['serial']?>)" />
</div>
</div> <!--here you forgot-->
</div>
<?php } ?>
and apply overflow:hidden on #product-grid and width as you want width with float:left no need to add float:left on .product-item so just remove it
#product-grid {
border-top: #F08426 2px solid;
margin-bottom: 30px;
overflow: hidden;
float: left;
width: 25%;
}
fiddle here
Note: I recommend to you use product-item as a class not id always use class for multiple item with same name
thanks
Thanks to every one that respond to my question. It gave me an insight into fixing the problem. I was able to get my grid working using the below code
body {
font-family: "open san", verdana, sans-serif;
font-size: 12px;
line-height: 1.5em;
color: #333;
background: #ffffff;
margin: 0;
padding: 0;
text-align: center;
width: 100%;}
.prod-box{
width: 200px; height: 340px;
padding: 10px; margin: 15px;
background-color: #fff;
float: left;
}
.prod-box img:first-child, .prod-box-list img:first-child{width: 190px; float: left;}
.prod-box h3 a{
text-decoration: none;
width:140px;
float: left;
margin: 5px 0;
color:#888;
font: italic normal 14px georgia;
font-style: italic;
}
.prod-box p{ display: none;}
.prod-box .old{
margin-right: 20px;
color: #be0000 !important;
text-decoration: line-through;
}
.prod-box .price{
width: 60px;
display: inline;
float: left;
font: italic 13px georgia;
color: #181818;
}
.prod-box .cart-ico{
border-radius: 20px;
width: 35px; height: 35px;
float: right;
margin: 5px;
cursor: pointer;
}
.prod-box .cart-ico:hover{
background-color: #7eb800;
}