I have this alert that I want to have an "X" button to dismiss the alert, but it doesn't have the bootstrap style. I already tried set the closeLabel to an empty string but don't fix the style issue
How should it be:
Here is the code:
<Alert variant="danger" onClose={() => setShowMessage(false)} dismissible>
<Alert.Heading>Oh snap! You got an error!</Alert.Heading>
<p>
Change this and that and try again. Duis mollis, est non commodo
luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
Cras mattis consectetur purus sit amet fermentum.
</p>
</Alert>
I have same problem.
found one post similar here but dontk work for me. But for the moment (until found a real solution) I use class ".close{}" (you can see it in the insperctor of the element) and modify css format for the button.
My css:
enter code here
.close ::before{
content: 'X';
visibility: visible;
color: "black";
font-weight: bold;
}
.sr-only::before{
visibility: hidden;
}
.close{
/*background-color: red; */
visibility: hidden;
position: absolute;
right: 32px;
top: 10px;
width: 20px;
height: 20px;
background-color: rgb(247, 12, 12, 0.5);
}
Related
I'm trying to use tinymce. So far so good, so I tried to add some formats (like adding some background colour, or making some styles for headers.
It does show everything in place but it won't be saved to the database with the format.
This is my configuration:
tinymce.init({
entity_encoding : "raw",
selector: '.wysiwyg',
plugins: "image textcolor colorpicker hr link table lists advlist contextmenu",
toolbar: 'styleselect | undo redo | bold italic underline | link image | forecolor backcolor | hr | table',
menubar: "",
contextmenu: "bold italic underline | bullist numlist | link | cell row column deletetable",
content_css : "style-tinymce.css",
valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
image_caption: true,
style_formats: [
{title: 'Image Left', selector: 'img', styles: {
'float' : 'left',
'margin': '0 10px 0 10px'
}},
{title: 'Image Right', selector: 'img', styles: {
'float' : 'right',
'margin': '0 10px 0 10px'
}},
{ title: 'Encabezado',
block: 'h2',
styles: { 'color': '#0871ad' }
},
{ title: 'Texto Resaltado',
inline: 'span',
styles: { 'color': '#000000',
'background-color': '#f6f433'
}
}
]
});
These are the steps that I'm taking:
I do add the image:
I set the image with the format "float right":
I add some special format to the text:
This is what is saved into the database:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus accumsan, massa at sollicitudin vulputate, mauris sapien vestibulum libero, id mollis arcu neque vitae odio. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla ornare tristique tempor. In finibus volutpat sapien. Nulla mi justo, luctus ut volutpat a, tienim. Mauris molestie placerat dui sed consectetur.
I did cut the est of the Lorem Ipsum text. As you can see, the image is saved, but the format won't.
It does not happen the same with the bold, or italic, for example, they do get saved. It only happens with my special style_formats.
I'm using tinymce 4.
What am I doing wrong? Thanks!
Just in case it helps someone some day: the problem was this ine:
valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
Telling tinymce that it should accept IMG as a valid element, I was actually telling them that it was the only valid element that it should accept!
Let me explain the situation. Currently I am doing a project to practice SCSS and React. It is a website dedicated to soccer team. The problem is that I am creating a custom modal window using CSS and HTML. What I want is that whenever I click the button "see pics" a modal window related to this card should open, while in my case all modal windows open at once.
All modal windows open at once stacked one on each other. Like that.
There are four modal windows like that overall, but only the top modal shows.
The HTML structure of these modal windows is the following:
They have got the same classes and ids.
In React part I have a component called PopUp, which gets information from db.json as props.
import React from 'react';
import Button from './button-round-dark';
const generateAdditionalInfo = ({info}) => {
if (info) {
return info.map((item) => {
const addInfo = item.additionalInfo;
console.log(addInfo);
return (
<div className="popup" id="popup">
<div className="popup__content" key={addInfo.id}>
<div className="popup__left">
<img className="popup__img" src={`../../${process.env.PUBLIC_URL}/images/additionalInfoPics/${addInfo.images[0]}`}/>
<img className="popup__img" src={`../../${process.env.PUBLIC_URL}/images/additionalInfoPics/${addInfo.images[1]}`}/>
</div>
<div className="popup__right">
x
<h2 className="heading-secondary u-margin-bottom-small">{addInfo.title}</h2>
<p className="popup__description">{addInfo.description}</p>
</div>
</div>
</div>
)
})
}
}
const PopUp = (props) => {
return (
<div>
{generateAdditionalInfo(props)}
</div>
)
}
export default PopUp;
db.json
"legendaryTeam":[
{
"id":"p1",
"name": "buffon",
"image":"buffon.jpg",
"years":"2001-2018",
"number":"18",
"position":"goalkeeper",
"physicalFeatures":{
"weight":"86",
"height":"194",
"speed":"7",
"power":"250"
},
"additionalInfo":{
"id":"1",
"images":["buffon_1.jpg","buffon_2.jpg"],
"title":"Buffon title",
"description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Etiam dignissim diam quis enim lobortis scelerisque. Egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla. Lorem sed risus ultricies tristique nulla aliquet enim. Ultrices in iaculis nunc sed augue lacus viverra vitae congue."
}
},
{
"id":"p2",
"name": "Ravanelli",
"image":"ravanelli.jpg",
"years":"1992-1996",
"number":"10",
"position":"forward",
"physicalFeatures":{
"weight":"75",
"height":"176",
"speed":"9",
"power":"300"
},
"additionalInfo":{
"id":"2",
"images":["ravanelli_1.jpg","ravanelli_2.jpg"],
"title":"Ravanelli title",
"description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Etiam dignissim diam quis enim lobortis scelerisque. Egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla. Lorem sed risus ultricies tristique nulla aliquet enim. Ultrices in iaculis nunc sed augue lacus viverra vitae congue."
}
}
Please pay attention to additionalInfo object, it is where information goes to PopUp component.
Custom CSS code for modal window looks like this.
.popup {
height: 100vh;
width:100%;
position:fixed;
top:0;
left:0;
background-color: rgba($color-black,0.8);
z-index:99999;
opacity: 0;
visibility: hidden;
transition:all .3s;
&:target {
opacity: 1;
visibility: visible;
}
&__content {
#include centrify;
width:75%;
background-color: $color-white;
box-shadow: 0 2rem 4rem rgba($color-black, .2);
border-radius: 3px;
display: table;
overflow: hidden;
}
&__left {
width:33.33333333%;
display: table-cell;
}
&__right {
width:66.666666666%;
display: table-cell;
vertical-align: middle;
padding: 3rem 5rem;
}
&__img {
display: block;
width:100%;
}
&__description {
font-size: 1.4rem;
margin-bottom: 4rem;
}
}
Modal window open with help of target selector. Now I am scratching head over how to make implement what I want. Please help me out. Do you have any ideas?
By the way other modal windows look like this. But they are lower in stack so they are not shown.
If you want to tinker with my project click here
To run react see picture below
To run db.json you need to install it globally
$ npm install -g json-server
And then run it, see pic below
To run SCSS see pic below
Your problem is not in your description, you bind the ButtonRoundDark to all of the modal. You need to add onClick event to your 'see pics' button. After click, fetch the data, show the modal.
I want to show show more text only if the p tag is more than 40px height and if the text expands on click of show more, it should change to show less. So how can I check the condo if the text size is more than 40px ? Kindly help.
<p class="expandable" ng-class={expanded:show}>long text-------</p>
<a ng-if="!show" ng-click="show=true">show more</a>
<a ng-if="show" ng-click="show=false">show less</a>
CSS:
.expandable {
line-height:40px;
Overflow:hidden;
}
.expanded{
line-height:auto;
}
Hi referer this https://plnkr.co/edit/gfQmrD1mRvF81QXp7C8C?p=preview
HTML
<p class="expandable hideContent" ng-class=showclass> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
ghjgjgjkghkk jkhkj
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.-</p>
<div class="show-more">
{{showtest}}
</div>
JS
$scope.showtest = 'ShowLess';
$scope.showmore = function(_logout) {
if($scope.showtest == 'ShowMore')
{
$scope.showtest = 'ShowLess';
$scope.showclass = 'hideContent';
}
else
{
$scope.showtest = 'ShowMore';
$scope.showclass = 'showContent';
}
}
using the Line-height i implement the class
CSS
/* Put your css in here */
.hideContent {
overflow: hidden;
line-height: 1em;
height: 2em;
}
.showContent {
line-height: 1em;
height: auto;
}
.showContent{
height: auto;
}
How to make a responsive image banner that has image and text layers with absolute positions? My client wants the banner along with the layered text and images to scale down when the screen goes smaller (Please refer to the screenshot below). I am not looking for a slider, this is just a simple banner with layers. My client has different banners(with layers) on every page, their website used to be non-responsive and now they want to make it responsive. CSS Media queries will probably not work here since I have to define a new font size and image width for every pixel change on the screen which I believe is time consuming.
As you can see, the banner along with the layered texts and images scales down as the screen goes smaller
Link to my fiddle: https://jsfiddle.net/ophLk9pz/1/
HTML:
<div class = "banner">
<img src = "http://i.imgur.com/yfGOPkH.jpg" />
<img src = "http://www.dummymag.com//media/img/dummy-logo.png" class = "layer-image">
<h1>Sample Banner Text</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.</p>
</div>
CSS:
.banner { width: 1440px; position: relative; }
.banner img { z-index: -1; }
.banner h1 {position: absolute; bottom: 30px; left: 10px; }
.banner p {position: absolute; top: 150px; left: 10px; }
.banner .layer-image { position: absolute; top: 0; left: 150px; z-index: 2; }
Any help or ideas would be greatly appreciated, thanks in advance!
You can try to use viewport percentage units on the texts:
https://drafts.csswg.org/css-values/#viewport-relative-lengths
h1 { font-size: 8vw }
And images can be scaled like so:
img {
height: auto;
width:100%;
}
If you need fancier scaling methods (contain, cover etc) i believe you need to have the image as a background-image
Does anybody know why a 3rd child in a 3 column fluid layout would drop down to the next line when there is no media query set at the point it moves?
I get the feeling its something to do with padding but I've tried removing all the padding and it still does it (all be it at a slightly different point).
The site is currently in WP Coming Soon Mode but if someone were able and willing to have a look at it I could probably put it live for a bit. Its driving me crazy!
As I don't have the adequate rating on here yet I'm not permitted to show photos so perhaps a link to them will work?
This is it at 1006px - this is fine.
CLICK HERE TO VIEW - Sample 1
This is how it looks when the size is taken down to 1001px - Not fine!
I expected it to scale and stay at 3 columns until it hits the first media query set at 889px but it doesn't. instead it does this...
CLICK HERE TO VIEW - Sample 2
AND THIS IS IT BEHAVING ITSELF, DOING AS I HAVE SET IT TO AT THE GIVEN 889px QUERY - fine.
... well I'm not permitted to post more than 2 links here so you are going to have to take my word for it here :(
This is the code:
<div id="Thepagewrap">
<div id="Theheader">
<h1>3 Column Responsive Layout</h1>
</div>
<div id="Thecontent">
<h2>1st Content Area</h2>
<p>This page demonstrates a 3 column responsive layout, complete with responsive images and jquery slideshow.</p>
</div>
<div id="Themiddle">
<h2>2nd Content Area</h2>
<p>At full width all three columns will be displayed side by side. As the page is resized the third column will collapse under the first and second. At the smallest screen size all three columns will be stacked on top of one another.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
</div>
<div id="Thesidebar">
<h2>3rd Content Area</h2>
<p>At full width all three columns will be displayed side by side. As the page is resized the third column will collapse under the first and second. At the smallest screen size all three columns will be stacked on top of one another.</p>
</div>
<div id="Thefooter">
<h4>Footer</h4>
<p>Footer text</p>
</div>
</div>
CSS
/* STRUCTURE */
#Thepagewrap {
padding: 5px;
}
#Theheader {
height: 100px;
padding: 0 15px;
}
#Thecontent {
float: left;
padding: 5px 15px;
width: 29%;
}
#Themiddle {
float: left;
margin: 0 6px 6px;
padding: 5px 15px;
width: 30%;
}
#Thesidebar {
float: left;
padding: 5px 15px;
width: 29%;
}
#Thefooter {
clear: both;
padding: 0 15px;
}
#Thepagewrap, #Theheader, #Thecontent, #Themiddle, #Thesidebar, #Thefooter {
border: solid 1px #ccc;
}
#Theheader, #Thecontent, #Themiddle, #Thesidebar {
margin-bottom: 5px;
}
#media screen and (max-width: 889px){
#Thepagewrap {
width: 94%;
}
#Thecontent {
width: 41%;
padding: 1% 4%;
}
#Themiddle {
width: 41%;
padding: 1% 4%;
margin: 0px 0px 5px 5px;
float: right;
}
#Thesidebar {
clear: both;
padding: 1% 4%;
width: auto;
float: none;
}
#Theheader, #footer {
padding: 1% 4%;
}
}
#media screen and (max-width: 600px) {
#Thecontent {
width: auto;
float: none;
}
#Themiddle {
width: auto;
float: none;
margin-left: 0px;
}
#Thesidebar {
width: auto;
float: none;
}
}
#media screen and (max-width: 480px) {
#Theheader {
height: auto;
}
h1 {
font-size: 2em;
}
#Thesidebar {
display: none;
}
}
Difficult to be sure without having a live URL to inspect. Often this sort of problem is due to margins and paddings breaking an underlying grid, but in this case the following looks problemaatic to me
#media screen and (max-width: 889px){
...
#Thesidebar {
clear: both; <===== why is this here?
padding: 1% 4%;
width: auto;
float: none;
}
}