I've been using entypo (downloaded from entypo.com), and displaying the icons like so:
.icon:before {
display: inline-block;
font-family: 'Entypo';
text-decoration: none;
speak: none;
}
.email:before {
content: "\2709";
}
Pretty standard. But since the hinting is off when you download it from entypo.com, I've switched to downloading it from fontello. Only now my css content codes don't work anymore.
I can see in the demo that fontello uses spans like this, to call the icons from the html:
<span class="i-code">0xe829</span>
But that just seems ugly to me. I want to do it from the css, but how can I find out what kind of codes to put in my css?
Ok, so I found out that what you have to do is not use the codes as mentioned on fontello:
U+E84D
U+E854
But rewrite these to:
\E84D
\E854
(so remove the "U+" and replace it with a "\")
Use them like so:
content: "\E84D";
EDIT:
So, on request, the complete CSS syntax you would use is:
.icon:before {
display: inline-block;
font-family: 'Entypo';
text-decoration: none;
speak: none;
}
.email:before {
content: "\E84D";
}
In combination with the following HTML:
Mail me
Related
I'm trying to insert LUI (Leonardi UI) library icons with CSS into our web app (QlikSense).
It works perfectly fine with icons with one "word" such as "play":
.source-sans-pro .qv-collapsed-listbox .title-wrapper::after {
font-family: "LUI icons" !important;
content: "play";
padding-right: 10px;
}
However, when trying to add icons with two "words" such as "arrow-down", it wont work anymore:
.source-sans-pro .qv-collapsed-listbox .title-wrapper::after {
font-family: "LUI icons" !important;
content: "arrow-down";
padding-right: 10px;
}
Anyone an idea how to fix this?
Try and replace the - with an _ (underscore) character, e.g. content: "arrow_down";
I keep getting this error in css. This screenshot is on dreamweaver. I have also tried on brackets and codesandbox. Nothing seems to be working.
enter image description here
To answer your question you are using a valid SASS or SCSS with nested classes in a .css file and hence the error is shown. You can use this link to convert SASS to CSS: SassMeister
The equivalent css would be:
header {
display: flex;
height: 140px;
background-color: #A7ACB1;
}
header nav {
flex: l;
}
header nav ul {
list-style: none;
margin: 0;
padding: 0;
}
Please use "code samples" in the editor to post your questions for the code snippet going forward.
I am trying to add additional toggleable section that user can show and hide.
My requirements:
supported on major browsers (Opera, Chrome, Edge, IE11, Firefox, Safari on Mac)
no javascript
And was thinking of using the <details> tag, however the code
<details>
<summary>Toggle</summary>
<p>Hideable</p>
</details>
does not work on the Edge / IE browsers.
Can I anyhow "make" it work, or is there anything else I can use for that task? Hacks are OK, as long as no javascript is present.
You can add a polyfill once on a page to make all the <details/>s on the page work:
<!-- Inside the body -->
<script src="//cdn.jsdelivr.net/npm/details-polyfill#1/index.min.js" async></script>
I know this is a JS solution but it doesn't require writing any JS for each individual <details/>. It can be used with a text written in a WYSIWYG editor.
This would be the suggested :checked method utilizing a hidden checkbox:
.toggler {
display: none;
}
.toggler+.toggler-content {
max-height: 0;
opacity: 0;
overflow: hidden;
transition: all .4s ease-in-out;
}
.toggler:checked+.toggler-content {
max-height: 1000px;
opacity: 1;
}
<div>
<label for="toggler-id-1">Toggle</label>
<input type="checkbox" id="toggler-id-1" class="toggler" />
<div class="toggler-content">Hideable</div>
</div>
I would still prefer going with #Finesse's solution because it allows you to use the semantically correct HTML element for the purpose.
Copy the below script and put it in a js file and then import it or write it directly in tags. This worked for me.
!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()}(0,function(){var o="details",i="summary";(function(){var e=document.createElement(o);if(!("open"in e))return!1;e.innerHTML="<"+i+">a</"+i+">b",document.body.appendChild(e);var t=e.offsetHeight;e.open=!0;var n=t!=e.offsetHeight;return document.body.removeChild(e),n})()||(document.documentElement.className+=" no-details",window.addEventListener("click",function(e){if("summary"===e.target.nodeName.toLowerCase()){var t=e.target.parentNode;if(!t)return;t.getAttribute("open")?(t.open=!1,t.removeAttribute("open")):(t.open=!0,t.setAttribute("open","open"))}}),function(e,t){if(document.getElementById(e))return;var n=document.createElement("style");n.id=e,n.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(n)}("details-polyfill-style","html.no-details "+o+":not([open]) > :not("+i+") { display: none; }\nhtml.no-details "+o+" > "+i+':before { content: "▶"; display: inline-block; font-size: .8em; width: 1.5em; }\nhtml.no-details '+o+"[open] > "+i+':before { content: "▼"; }'))});
If you don't want that arrows then just remove this part from end
+o+" > "+i+':before { content: "▶"; display: inline-block; font-size: .8em; width: 1.5em; }\nhtml.no-details '+o+"[open] > "+i+':before { content: "▼"; }'
I have question regarding . I am using wordpress and create a new page then under that page i am using the and pass a url by attribute src. So the is working fine and url's page is showing in it. Here i have to remove some part of html from and i try to hide them on firebug, they hide there easily but not working when i apply my css to styelsheet file.
My css is not loads/works on , please suggest me a solution so that i can make my page comfortable.
#iframeBody iframe#contentArea {
height: 100%;
left: 0;
width: 100% !important;
}
#iframeHeader iframe#banner {
display: none;
}
#iframeBody iframe#menuItem {
display: none;
}
iframe#menuTab {
display: none;
}
<iframe src="http://freightforce.com/MainFrame.aspx?id=Customers_horz_accordion.aspx" width="100%" height="1000px"></iframe>
Thanks.
On my website i use non standard cyrillic font. It looks well but it have problems with some special symbols, for example - quotes (for some reason opening and ending quote look different).
I would like to set font-family for specific symbols using CSS. Is it possible?
You can manage this using a unicode range #font-face rule
MDN Reference
I'm unsure as to how well this demo will work in a Snippet as it will depend on you have the designated font installed. However, in general, it's something like this:
#font-face {
font-family: 'Algerian';
src: local('Algerian');
unicode-range: U+022-026;
}
div {
font-size: 4em;
font-family: Algerian, sans-serif;
}
div {
text-align: center;
}
p {
font-size: 72px;
}
<div>
<p>" Lorem & Ipsum "</p>
</div>
In this instance I've applied the rule to open & closed quotes and the ampersand.
Support: CanIUse.com
For Firefox though:
Support can be enabled in Firefox using the layout.css.unicode-range.enabled flag
If you want to change your symbols to a new font then you'll have to wrap them in a tag and assign a class...
in your CSS add a class for the font
.symbol {
font-family: Arial;
}
Then in your HTML you will need to use this class on your symbols...
<p>Jesse Jackson? Do you even... ah, I see you have a telephone at least. You know that blinking thing I've been calling you on?
<i class="symbol">"<i>I will break this, I will BREAK THIS.<i class="symbol">"<i> </p>
If the problem is only for quotes?
You could set the :before and :after pseudo for a <blockquote></blockquote>, which could be set to a icon font. Perhaps fontawesome?
blockquote {
position: relative;
padding: 1em 2em;
}
blockquote:before,
blockquote:after {
position: absolute;
font-family: FontAwesome;
}
blockquote:before {
content: "\f10d";
left: -1em
}
blockquote:after {
content: "\f10e";
right: -1em
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="stylesheet">
<blockquote>Jesse Jackson? Do you even... ah, I see you have a telephone at least. You know that blinking thing I've been calling you on? I will break this, I will BREAK THIS. Damn druggie idiot. Is this what you've been doing the whole time I've been trying to reach
you?</blockquote>
you can use easily like
.custom-font{
font-family:any
}
and then
<div>hello there <span class='custom-font'>i am custom</span> but i am not</div>