CSS Content to add HTML tags
A similar effect can be achieved:
#br:after {
content: "";
display: block;
}
http://jsfiddle.net/2j4JD/
How to add a br tag in reactjs between two strings?
You should use JSX instead of string:
<div>No results.<br />Please try another search term.</div>
Because each jsx should have 1 wrapper I added a
<div>
wrapper for the string.
Here it is in your code:
render() {
let data = this.props.data;
let isLoading = this.props.isLoading;
let isDataEmpty = Object.entries(data).length === 0;
let movieList = isLoading ? <Loader /> : isDataEmpty ? <div>No results.<br />Please try another search term.</div> :
Object.entries(data).map((movie, index) => <MovieTile key={index} {...movie[1]} />);
return (
<div className='movieList'>{movieList}</div>
);
}
Add a tooltip to a div
For the basic tooltip, you want:
<div title="This is my tooltip">
like:
.visible {
height: 3em;
width: 10em;
background: yellow;
}
<div title="This is my tooltip" class="visible"></div>
How to align an input tag to the center without specifying the width?
You need to put the text-align:center
on the containing div, not on the input itself.
How to inserted HTML tag from pseudo-element content:
You can't inject HTML elements using the content
property of CSS pseudo-elements; you can, however, set them to display: block
and (as seems to be required in your question, though not your demonstrated/attempted code) use height
and background-color
to emulate an <hr />
:
article::before {
content: '';
display: block;
margin: 1em 0;
height: 5px;
background-color: #f00;
}
article::before {
content: '';
display: block;
margin: 1em 0;
height: 5px;
background-color: #f00;
}
<article>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</article>
<article>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</article>
CSS content property: is it possible to insert HTML instead of Text?
Unfortunately, this is not possible. Per the spec:
Generated content does not alter the document tree. In particular, it is not fed back to the document language processor (e.g., for reparsing).
In other words, for string values this means the value is always treated literally. It is never interpreted as markup, regardless of the document language in use.
As an example, using the given CSS with the following HTML:
<h1 class="header">Title</h1>
... will result in the following output:
<a href="#top">Back</a>Title
Related Topics
IE7 CSS Inheritance Does Not Work
Is There a CSS "Haschildren" Selector
Why Does the CSS3 Pseudo ::Selection Not Change the Color for All Parts
Why Do Chrome and Firefox Show Different Flex Layout Results
How to Override a Less Mixin Variable Based on a Parent's Variable
How to Create a Inset Box-Shadow Only on One Side
How to Avoid iOS Automatic Font Size Adjustment
How to Write CSS Fallbacks for Vh Vw
Multiple CSS Keyframe Animations Using Transform Property Not Working
Customise Tumblr's *New* Like Button Iframe {Likebutton}
How to Draw a Diagonal Line Using CSS3
Vertically Center Image on Page and Maintain Aspect Ratio on Resize
Apply Background-Size to Individual Layer of a Multiple Background
Suppress Wkwebview from Scaling Content to Render at Same Magnification as Uiwebview Does