I am having troubles resizing the slideshow on my Shopify css.
This is the code
/* Slider */
.slick-slider
{
position: relative;
display: block;
box-sizing: border-box;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
-ms-touch-action: pan-y;
touch-action: pan-y;
-webkit-tap-highlight-color: transparent;
}
I am using the boost theme,
I have tried toggling height and weight with these arguments:
height: 50%
width: 50%
and
max-height:50%
but to no avail. I would like to halve the height and width of my slider
I took a look at your source code, and if you're referring to the main homepage carousel, it looks like your slider is wrapped in the following div:
<div class="full-width relative js-slideshow-section slick-initialized slick-slider slick-dotted" data-autoplay="true" data-autoplayspeed="8000">
The full-width class applies the following CSS rule in your theme.scss.css:
.full-width {
min-width: 100%;
}
Your CSS rules are being ignored because of selector specificity. Either replace the class full-width or if you want to change the size based on viewport size, consider adding a media query that overrides those rules.
If you'd like to reduce the height of your carousel, consider styling, not the slider container itself, but each individual slide. The following CSS would adjust the slider width to 50%, center it with margin rules, and adjust the height of slides with a class of .slide-heightchange to 400px:
/* Slide container */
.full-width.adjusted-width {
width: 50%;
margin-left: auto;
margin-right: auto;
}
/* Individual slide */
.slide-adjusted-height {
height: 400px;
}
Note that I added the adjusted-width class to your carousel container selector. This, together with the full-width class will create a more specific CSS selector that should apply the rule. However, for semantic purposes you may consider renaming the full-width class or removing it altogether with JavaScript on resize. Also, the width: 50%; rule will change the width size based on the containing block size. You may want to consider a different width rule.
Related info
It looks like your Shopify theme is using the Slick library for the slider. The documentation and sample usage can be found at http://kenwheeler.github.io/slick/
As the docs explain, your slide divs are placed inside of a div container that is then used to initialize the carousel.
Something else that might be useful is configuring the slider's JS settings. The Slick library has adaptiveHeight and variableWidth settings that both default to false. They allow you to configure the behavior of your carousel when dealing with slides of different heights and widths.
Related
To supplement my icon set, I'm using SVG's and currentColor.
However, I'm seeing some issues with flickering when the (font)color changes or there's animation on the page.
Example of color change on hover causes flicker
body{
color:green;
font-size:50px;
}
.dynamicSVG {
/*
Allows us to colour SVGs using mask, the colour will follow the text colour
NOTE: doesn't work well with SVG's with lots of colors as you lose the contrast
*/
height: 1em;
min-width: 1em;
display: inline-block;
-webkit-mask: var(--src) no-repeat 50% 50%;
mask: var(--src) no-repeat 50% 50%;
-webkit-mask-position: left;
mask-position: left;
-webkit-mask-size: contain;
mask-size: contain;
background-color: currentColor;
vertical-align: middle;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.dynamicSVG > img {
/*
Here I use an child img element inside the i.dynamicSVG.
It uses the style SRC variable to remove the need to set the URL twice in HTML, a nice CSS hack.
We do this to load in the image and ensure the dynamic SVG is the correct size and dimensions...
Which it wouldn't have been as we're using background + mask for the dynamic icon
It does mean the image will be called twice, but due to caching it shouldn't be an issue and isnt visible to the user
*/
content: var(--src);
height: 100%;
visibility: hidden;
/*Ensure the max height isn't overridden*/
max-height: 100% !important;
vertical-align:top;
}
.dynamicSVG:hover{
color:red;
}
<div class="dynamicSVG" style="--src:url('http://upload.wikimedia.org/wikipedia/fr/c/c8/Twitter_Bird.svg')"><img /></div>
<span>< Hover Me</span>
I've read some articles which suggest -webkit-translate-3d, -webkit-backface-visibility,-webkit-transform-style, none of which resolves my issue.
Essentially I use a CSS mask to colorise the SVG to my font colour.
The child img allows it to size correctly relative to the height.
However, during transitions or in particular changing the font colour (and in turn the mask colour when using currentColor, the image is either hiding completely until the transition is complete or flickers.
The question is firstly, is there a better way of linking to an SVG (without embedding the XML) and using CSS to set the colour, or if there's no better solution, how can we stop the flickering / hiding during transitions.
I've mainly noticed it in chrome in my application, but in this example we can see it occur in modern edge too.
I have a paragraph in HTML using the p tag. Now i want to change the height and width of this paragraph so it only shows the begining (head) of the paragraph and then when i hover over it, it displays the full paragraph. How do I do this using CSS?
NOTE** I CANNOT CHANGE THE HTML CODE SO I MUST ONLY PLAY AROUND WITH CSS..
The following base code will work for you, you can modify it to enable CSS animations etc. as necessary.
p {
// Put whatever height you want here, we're using max-height here so that
// paragraphs that are smaller than this don't get extra blank spacing.
max-height: 20px;
// Hide the extra content
overflow: hidden;
}
p:hover {
max-height: none;
}
It's better if you use JavaScript for such stuff, but if you insist on CSS, here you go.
p{
border: solid;
height: 10px;
overflow:hidden;
}
p:hover{
height: 100%;
}
A small Example here
I am working on Bootstrap theme where its responsive. I disable the responsiveness on a child theme by adding a code in functions.php. All works well , no problem.
Now the parent container, is now fixed:
HTML:
<div class="container">
CSS:
.container{width: 940px;}
But I would like the footer section to have sitewide background color. How do I able to do this?
I have tried setting different methods like width:auto, width: 200% ,but its not giving me the desired result.
Supposing this is the footer section:
<footer>
My footer
</footer>
My attempted CSS on a child theme(not working)
footer {
background: #CCCCCC;
width:100% !important;
position:absolute !important;
}
Also is this possible without setting too many !important on CSS property? Thanks.
If your footer is inside the div.container which has width:940px; then giving your footer 100% width will make it 940px wide.
You need to have the footer outside the container to give it 100% width of the body.
When you give 100% width, the element gets its container's width. So in your code, even with the important keyword, it'll get the container's width (because that what 100% is supposed to do).
Just take the footer outside of the container.
Then it'll work and you won't need this !important keyword.
As others have mentioned, removing the footer from the parent container of .container will allow the width of it to be the entire size of the viewport/document.
If you are unable to change this level of structure of the HTML due to your template, you can fake the width using pseudo-elements, like so:
footer {
position: relative;
background-color: lightblue; /* Match the color of the body background */
}
footer::before, footer::after {
content:"";
position: absolute;
top: 0;
bottom: 0;
width: 9999px;
/* some huge width */
background-color: inherit;
}
footer::before {
right: 100%;
}
footer::after {
left: 100%;
}
See jsFiddle.
Taken from CSS Tricks: Full Browser Width Bars
I've got the following class, which works in all the major browsers except Firefox for PC. Specifically the issue is with the content being on a regular element—Ffx doesn't seem to like it on anything except a ::before or ::after pseudo-element. Trouble is, ::after does not inherit the size of its base element.
html
<span class="col-3 myImg"></span>
css
.col-3 {
width: 25%;
}
.myImg {
/* content: url('img.png'); works in everything by Ffx on PC */
display: block;
position: relative;
}
/* v Needed for Ffx on PC */
.myImg::after {
background: red;
content: url('img.png');
display: block;
max-width: 100%; /* affects only the background colour */
position: absolute;
width: 100%; /* affects only the background colour */
}
I don't want to set a height—I want the height to stay proportional to the width (which is determined by col-# from bootstrap v3).
I don't want to use a bunch of image tags because that means an update will require a bunch of edits (instead of one central one to the css).
Related SO question: Can I change the height of an image in CSS :before/:after pseudo-elements?
JS Fiddle
EDIT I want the image to be 100% the width of the base element (the span) and the image's height to scale proportionately.
Id like to know why my inner wrap of the desktop css for this site is not working.
Basically if set innerwrap to margin:0 auto; and width: auto; there is no problem, but it's not centered on the footer or main div
When I have innerwrap as it's currently set margin:0 auto; and width:960px; you'll notice that the page presents a horizontal scroll bar after resizing the window a bit, and all the content is squished to the left with a white background starting to become visible.
Is there anyway to have it transition fluidly to the next tablet size layout without have a scroll bar appearing and content getting squished?
It shows Scrollbar because of the padding you apply in .innerwrap
Read this article about the Box Model
Use of padding on the sides of certain elements when applying 100% width to parent element its not recommendable because it adds width to the whole group, and since you,re using the browsers width it shows the scrollber to see the extra space you added.
My humble advice is that if you want a block element to appear centered apply an margin:auto style rule whenever is possible, the same also has to be displayed as a block element with no float.
Remove this:
.innerwrap {
margin-left: auto;
margin-right: auto;
padding-left: 10%;
padding-right: 10%;
width: 80%;
}
Keep This
.innerwrap {
margin: auto;
width: 960px;
}
Since you are applying fixed margins for you social icons they will show misplaced, so don't use fixed margins for centering them, use percentage width instead.
you may want use a common class for aligning them
.social {
background-position: center center;
background-repeat: no-repeat;
display: block !important;
float: none;
height: 150px;
margin: auto;
padding-top: 50px;
width: 30% !important;
}
For a.twittersocial and a.twittersocial:hover and the rest of the social links just keep the background properties.
Create a determined class if you need to apply common style rules to several elements (if there are many of them) and avoid usage of ID selectors whenever is possible, use classes instead (.daclass).
Use a web inspector like Firebug to track down styling errors.
Good luck Developer!