I am using Wolox's chat widget
https://github.com/Wolox/react-chat-widget
And I am trying to make a horizontal row of multiple chat widgets along the bottom of the screen. I am trying to override the class .rcw-widget-container
.rcw-widget-container {
bottom: 0;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
margin: 0 20px 20px 0;
max-width: 370px;
position: fixed;
right: 0;
z-index: 1;
}
I have two chat Widget's that I want to put side by side, but I want to do it inline with React. Because my number of widgets will grow depending on how many user chats I open. So the right positioning needs to be dynamic. I just don't know how to accomplish this. Or if it's possible
https://codesandbox.io/s/vvnjyr9r30
EDIT
Something like this may work, but I don't think I am getting the syntax right.
.chat1 .rcw-widget-container {
right: 350px;
}
.chat2 .rcw-widget-container {
right: 400px;
}
Component
<Widget className="chat1" handleNewUserMessage={(e) => this.handleNewUserMessage(e, new Date().getTime())} />
<Widget className="chat2" handleNewUserMessage={(e) => this.handleNewUserMessage(e, new Date().getTime())} />
as I can understand probably you are looking for something like this:
In this case you can try:
.App {
font-family: sans-serif;
text-align: center;
display: flex;
flex-direction: row;
}
.rcw-widget-container {
border: 2px red solid;
position: initial;
}
Also, try to reorder the imports in index.js to override the styles.
import "react-chat-widget/lib/styles.css";
import "./styles.css";
While not inherently possible in CSS modules alone, the author of the react-toolbox library has actually solved this particular problem very nicely
Read their github docs which are more in depth on the subject at https://github.com/react-toolbox/react-toolbox#customizing-components
A list of the themeable classes for a particular component is given on the component demo page on their site too
Related
Hy everyone.
I'm facing an issue that makes me lose my mind.
On iOS 15 or 16, Safari, with the setting "Single tab" enabled (meaning you have the Safari searchbar on top), when I focus my input, a weird padding animation gets triggered.
Here is my code, the most simplified possible.
The stack:
react
scss
export const SearchBusinessPage = ({whatInputContent, onWhatChange}) => {
return (
<div className={classes({ inputContainer: true })}>
<input
autoComplete={'off'}
className={classes({
input: true
})}
type='text'
value={whatInputContent || ''}
onChange={e => onWhatChange(e?.currentTarget?.value || '')}
/>
</div>
);
}
and the CSS
.inputContainer {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
background: linear-gradient(to top, #c6ffdd, #fbd786, #f7797d);
height: 100vh;
width: 100%;
}
.input {
flex: 1;
color: var(--grey-700);
font: var(--regular) var(--body-3);
&::placeholder {
color: var(--grey-500);
opacity: 1;
}
&:focus {
&::placeholder {
opacity: 0.5;
}
}
}
As you can see, nothing crazy in my code.
But I can't get rid of that iOS behavior that, on input focus, wants to add a padding top or I don't know what. I tried many thing but couldn't find what can I do. Any idea around here ?
Well, if anyone has the same trouble, the solution I found was, actually, pretty straight forward. You can use this CSS pretty high in the DOM. The solution comes with unintended side effects, but it works anyway.
That blocks Safari UI from moving. So, no UI move, no problem 🤷
height: 100%;
max-height: 100%;
min-height: 100%;
width: 100%;
position: absolute;
overflow: scroll;
I cannot figure out how to get some basic CSS styles to apply to my blog. I'm trying to customize my blog summary page. I want the "read more" button centered and for the picture to show correctly. For some reason the picture keeps moving and it cuts it half off. I've tried multiple things to different classes and nothing works. It was originally on the left with the text to the right of the thumbnail and I'm moving the picture above the text if that means anything.
I've tried text align center for the button in multiple divs and it doesn't budge. Can anyone help? I can only adjust CSS not HTML on my Squarespace site, and the limited styles they give you doesn't allow me to adjust any of this. I'm not a coder, I just kinda understand it enough, so any help is appreciated.
Here is the page: https://www.themodernrenovator.com/blog
Here is custom CSS I added to make the button a circle, but can't get it to center:
text-align: center;
display: table;
width: 100px;
border-radius: 30px;
padding: 12px !important;
background-color: #f0ede9;
margin: auto;
}
.view-list article .excerpt-thumb {
width: 100%;
position: inherit;
}
.view-list article .excerpt-thumb .intrinsic .content {
position: inherit;
padding-bottom: 0px;
}
.intrinsic {
padding: 0px !important;
}
.entry-title {
text-align: center;
}
.article-dateline {
text-align: center;
}
article .post span.inline-action {
display: inline-block;
text-align: center;
}
.article-meta {
display: none;
}
I'd recommend centering the "READ MORE" button using the following CSS, inserted via the CSS Editor:
article .post span.inline-action {
display: inline-block;
text-align: center;
}
The "cut off" image problem, on the other hand, should not be corrected with CSS because it is an issue with Squarespace's ImageLoader function. To correct it, add the following via global Footer code injection. If code injection is not available to you, insert the code via a Markdown block in the footer of your website.
<script>
// Fix Squarespace ImageLoader Bug.
function fixImages() {
var images = document.querySelectorAll('img[data-src]');
var i = images.length;
while (i--) {
ImageLoader.load(images[i], {load: true});
}
}
fixImages();
window.Squarespace.onInitialize(Y, function() {
fixImages();
});
</script>
Your images are cut off because you have a top: value that's currently set to -300px. I can't tell where it's being affected just by looking at this, but somewhere in your styling you have the child img of your excerpt-image getting a top value being set.
To center your 'read more' link: .inline-read-more { margin: auto; }
Hi I just started using Material UI and am having a hard time styling the components. I am building a sign in page and would like my Submit button to be all the way to the bottom right. If someone can help me out that would be greatly appreciated because it seems to be inheriting styles from everywhere else but where I would like to!
I have tried adding
textAlign: 'right'
to buttonStyle and that does not work. I have also tried adding
text-align: right;
to my .form-button CSS.
The only thing that affects anything is removing the .App
Login.js
<div className='form-container'>
...
<Button
style={buttonStyle}
className='form-button'
variant='contained'>
Log-In
</Button>
</div>
...
const buttonStyle = {
backgroundColor: '#527354'
};
App.css
.App {
text-align: center;
}
.form-button {
width: 83px;
height: 36px;
box-shadow: 0px 1px 3px #00000033;
}
.MuiButton-label {
color: var(--primary-white);
font-family: 'Open Sans', sans-serif;
}
.form-container {
max-width: 400px;
margin: 2rem auto;
overflow: hidden;
padding: 0 2rem;
}
Another main goal would be to avoid inline styling because I do prefer keeping it within my style sheet. But if not possible or too overly difficult, I will inline style (as I did with the background-color).
As keikai has mentioned in the comment, you may check the Documentation in this link material-ui.com/styles/basics for overriding style.
For 'it seems to be inheriting styles from everywhere else'
I will suggest you to use styled-components instead of global css import, which mess up everywhere. Try this,
npm install --save styled-components
It creates a css class that only apply to the component.
Sample code:
import styled from 'styled-components'
const MyDiv = styled.div`// can be span, section, etc
// add your style here for the div
your div style(optional)
// your class css inside the div
.form-container {
max-width: 400px;
margin: 2rem auto;
overflow: hidden;
padding: 0 2rem;
}
// add more class if you have any
`
Then wrap your component with
// your newly created styled div
<MyDiv>
// component that needs your style
<MyComponent />
</MyDiv>
Your style will only be applied to MyDiv and MyComponent, and nothing else.
It may took awhile to get used to it, but it is extremely useful.
is anyone here using Elementor?
I'm trying to create a header with Elementor. 3 columns, I have a logo in the left, search bar in the middle and a navigation menu on the right side.
Basically, what I wanted to achieve is something like this.
Expected Output
But what I'm currently done is Output
Adding a border on it Output-with-Border
Here is the issue when the screen/window is resized Issue
Where it should be something like this Expected-output-on-resize
To give you more details, I wanted to achieve the same functionality as the below code on Elementor.
.container {
margin: 0;
padding: 0;
list-style-type: none;
display: flex;
flex-wrap: wrap;
}
.flex {
background: #6AB6D8;
padding: 10px;
margin-bottom: 50px;
border: 3px solid #2E86BB;
color: white;
font-size: 20px;
text-align: center;
position: relative;
}
.flex:after {
position: absolute;
z-index: 1;
left: 0;
top: 100%;
margin-top: 10px;
width: 100%;
color: #333;
font-size: 18px;
}
.flex1 {
flex-basis: auto;
}
.flex1:after {
content: 'auto';
}
.flex2 {
flex: 1;
flex-basis: fill;
}
.flex2:after {
content: 'fill-remaining-space';
}
.flex3 {
flex-basis: min-content;
}
.flex3:after {
content: 'min-content';
}
<ul class="container">
<li class="flex flex1"><div style="background: #000; width: 200px;">Logo</div></li>
<li class="flex flex2"><div style="background: #000; width: 100%; margin-right: 10px; margin-left-10px;">Search-Bar</div></li>
<li class="flex flex3"><div style="background: #000; width: 350px;">Navigation Menu</div></li>
</ul>
I don't think it's possible by using the free version of Elementor. However you can still achieve what you want.
The idea is by using the ShortCode.
Since you are using OceanWP theme plugin then you will need to install the Ocean Extra plugin first.
STEP 1: Create templates
You will need to create a template for those four elements by navigating into your WordPress Dashboard > My Library then create the templates by clicking the Add New button and name them with the following:
search-bar
logo
navigation-menu
header
Each of the templates you created will generate a shortcode so take note of them.
STEP 2: Edit the templates you created using Elementor
Edit the template you created using Elementor, on the search-bar use the widget of Advanced Woo Search since you said you are using its plugin, you may also use its shortcode if it has a shortcode,just search for the widget ShortCode in Elementor then drag and drop it into the section, input the shortcode of the Advanced woo search then make the width full and 100%, save and publish it.
In the template Logo, edit it again using Elementor then use the widget Custom Header Logo as you said you are using it, then go to Advanced > Positioning then set the Width to Inline(Auto) and Vertical Align to Start. This will position the logo in the Left side of the section otherwise, position it into the left side, save and publish it.
Edit the template navigation-menu using Elementor, from the widgets search for Custom Header Nav and use it then position it into the right side of the section.
NOTE: You don't have to change anything in the section of Elementor.
The last thing is the header template, before editing the header template, you must create a shortcode with the tag you created, so don't edit it yet, proceed to next step.
STEP 3: Create a shortcode under your function.php
function cs_custom_header_shortcode( $atts ) {
$logo = do_shortcode('[shortcode of logo template]');
$search = do_shortcode('[shortcode of search-bar template]');
$nav = do_shortcode('[shortcode of navigation-menu template]');
echo '
<div class="cs-flex-container">
<div class="cs-flex-item cs-flex1"><div>'.$logo.'</div></div>
<div class="cs-flex-item cs-flex2"><div>'.$search.'</div></div>
<div class="cs-flex-item cs-flex3"><div>'.$nav.'</div></div>
</div>
';
}
add_shortcode( 'cs_custom_header', 'cs_custom_header_shortcode');
copy and paste the above code into your function.php, I've use your idea, I just replace the tag into div.
Notice the do_shortcode('[shortcode of logo template]');, replace the [shortcode of logo template] with the shortcode of those templates you created.
Your shortcode now for this is [cs_custom_header].
STEP 4: Edit the header template using elementor and use the shortcode [cs_custom_header].
Edit the header template using Elementor, then from the list of widget search for ShortCode then drag and drop it into the section and input the following shortcode [cs_custom_header].
STEP 5: Edit the CSS style.
Go to your Wordpress Dashboard > Appearance > Customize > CSS/JS and input the following CSS style.
.cs-flex-container {
margin: 0;
padding: 0;
list-style-type: none;
display: flex;
flex-wrap: wrap;
}
.cs-flex-item {
background: #6AB6D8;
padding: 10px;
margin-bottom: 50px;
border: 3px solid #2E86BB;
color: white;
font-size: 20px;
text-align: center;
position: relative;
}
.cs-flex-item:after {
position: absolute;
z-index: 1;
left: 0;
top: 100%;
margin-top: 10px;
width: 100%;
color: #333;
font-size: 18px;
}
.cs-flex1 {
flex-basis: auto;
}
.cs-flex1:after {
content: 'auto';
}
.cs-flex2 {
flex: 1;
flex-basis: fill;
}
.cs-flex2:after {
content: 'fill-remaining-space';
}
.cs-flex3 {
flex-basis: min-content;
}
.cs-flex3:after {
content: 'min-content';
}
You may also use it into your css child theme and again I just use your css code.
With the code you provided, I assume you know how to work on most of the thing but just lack on idea of how to do it using Elementor so I won't be very specific in everything, just a guide.
The steps maybe long, but you will achieve what you want with it.
Have a nice day.
im using wordpress oceanwp theme to create my ecommerce website. Im using medium header sytle for m website. however, i wan my mobile screen to show a different header style of "minimal".
So is used the custom css code to fix this. However, the arrangement in header are (logo/cart icon/menu). But what i expected is rearrange it's position to (menu/Logo/cart icon).
#media only screen and (max-width: 959px) {
.top-header-wrap.clr {
width: 50%;
}
.bottom-header-wrap.clr {
width: 50%;
}
div#site-header-inner {
display: flex;
}
.oceanwp-mobile-menu-icon.clr.mobile-right {
height: 100%;
line-height: 100px;
}
}
Is there any css code the can help me to solve problem. I expected to get my mobile size screen's header with the arrangement of (Menu/Logo/Cart Icon)
Thank you!
can you Please send the html code how they are now
or
You have to put the code like this
.header{
display: flex;
align-items: center;
justify-content: center;
}
.header div{margin:0 10%; text-align:center;}
<div class="header">
<div>menu</div>
<div>logo</div>
<div>Cart</div>
</div>
refer this for flexbox ordering.
Use display flex for parent class of header elements and custom order can be specified like this :
.box :nth-child(1) { order: 2; }