tinymce custom bullet and number lists - tinymce
I am wondering if it is possible to create custom bullet and number lists?
I've added the plugin advlist and tried the examples others have tried here and here. The first one seems to allow some changes to be made. However, I am trying to replace the list-style-image for either bullet or number lists with a custom image but the "styles" option "listStyleImage" does not seem to work even though it appears in the application code.
I've also tried adding a css class to see if that would work, but the "classes" statement doesn't seem to work either.
I've set the init section up like in the examples and followed the options in the formats documentation, but classes and and setting "listStyleImage" for styles don't seem to work.
I'm pretty sure adding the class to the html code manually will work. I would just like to have it set as a custom list so that it does not have to be done manually.
Is this even possible?
Is there another way to accomplish this?
UPDATE: To get around this for now, I am having to manually add a class to the html via the editor. It works, but it would be nice if there were a way to do it by adding custom lists.
The only way that i found till now to cahnge the bullets to an image is by using the
style_formats.
After you add a list simply mark It and apply the format.
the tinymce code:
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l ink image | print preview media fullpage | forecolor backcolor emoticons",
image_advtab: true,
style_formats: [{
title: 'checkMark', selector: 'li',
styles: {
'list-style-image' : 'url("../images/check-mark.png" )' //your desired image
}
}],
stumbled upon this question while doing research, on the same issue, after some debugging found a way to do this
the advlist plugin should be installed and activated
within the initialization, advanced list style should be configured for example:
tinyMCE.init({...
advlist_bullet_styles: [{
title: 'image bullets',
styles: {
listStyleImage: "url('url/to/image.png')"
}
}, {
title: 'Default',
styles: {
listStyleType: '',
listStyleImage: ""
}
}, {
title: 'Circle',
styles: {
listStyleType: 'circle',
listStyleImage: ""
}
}, {
title: 'Disc',
styles: {
listStyleType: 'disc',
listStyleImage: ""
}
}, {
title: 'Square',
styles: {
listStyleType: 'square',
listStyleImage: ""
}
}],
...});
this gives you the default bullet styles as well as custom image style. the styles array sets properties of UL element.
and you set templates for number lists by using advlist_number_styles property.
Here is a good example of ol list with multi level numbering.
EXAMPLE the SCSS compiles to:
ol {
list-style: none;
position: relative;
padding-left: 15;
margin: 0;
}
ol {
counter-reset: level0 0;
}
ol li::before {
content: counter(level0,decimal) "";
counter-increment: level0;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol li:empty + {
counter-reset: level0 0;
}
ol li:empty::before {
display: none;
}
ol ol {
counter-reset: level1 ;
}
ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "";
counter-increment: level1;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol li:empty + ol {
counter-reset: level1 ;
}
ol ol li:empty::before {
display: none;
}
ol ol ol {
counter-reset: level2 ;
}
ol ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "." counter(level2,decimal) "";
counter-increment: level2;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol ol li:empty + ol ol {
counter-reset: level2 ;
}
ol ol ol li:empty::before {
display: none;
}
ol ol ol ol {
counter-reset: level3 ;
}
ol ol ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "." counter(level2,decimal) "." counter(level3,decimal) "";
counter-increment: level3;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol ol ol li:empty + ol ol ol {
counter-reset: level3 ;
}
ol ol ol ol li:empty::before {
display: none;
}
ol ol ol ol ol {
counter-reset: level4 ;
}
ol ol ol ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "." counter(level2,decimal) "." counter(level3,decimal) "." counter(level4,decimal) "";
counter-increment: level4;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol ol ol ol li:empty + ol ol ol ol {
counter-reset: level4 ;
}
ol ol ol ol ol li:empty::before {
display: none;
}
ol ol ol ol ol ol {
counter-reset: level5 ;
}
ol ol ol ol ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "." counter(level2,decimal) "." counter(level3,decimal) "." counter(level4,decimal) "." counter(level5,decimal) "";
counter-increment: level5;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol ol ol ol ol li:empty + ol ol ol ol ol {
counter-reset: level5 ;
}
ol ol ol ol ol ol li:empty::before {
display: none;
}
ol ol ol ol ol ol ol {
counter-reset: level6 ;
}
ol ol ol ol ol ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "." counter(level2,decimal) "." counter(level3,decimal) "." counter(level4,decimal) "." counter(level5,decimal) "." counter(level6,decimal) "";
counter-increment: level6;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol ol ol ol ol ol li:empty + ol ol ol ol ol ol {
counter-reset: level6 ;
}
ol ol ol ol ol ol ol li:empty::before {
display: none;
}
ol ol ol ol ol ol ol ol {
counter-reset: level7 ;
}
ol ol ol ol ol ol ol ol li::before {
content: counter(level0,decimal) "." counter(level1,decimal) "." counter(level2,decimal) "." counter(level3,decimal) "." counter(level4,decimal) "." counter(level5,decimal) "." counter(level6,decimal) "." counter(level7,decimal) "";
counter-increment: level7;
position: absolute;
right: 100%;
margin-right: 15px;
text-align: right;
font-weight: bold;
font-size: 0.8em;
}
ol ol ol ol ol ol ol ol li:empty + ol ol ol ol ol ol ol {
counter-reset: level7 ;
}
ol ol ol ol ol ol ol ol li:empty::before {
display: none;
}
li {
margin-top: 0.5em;
margin-bottom: 0.5em;
position: relative;
}
Background
I know this question is now 5 years old but I ran into a similar issue and found no resources to help resolve it. I also know this is seldom an issue because the world uses a small black circle as a bullet (hence the name) everywhere in the world. I posted the question on the TinyMCE community site, but after a few days my account was locked (what?!). If anyone has a better solution, please let me know. This solution seems a little too much like it's held together with Duck Tape and if a TinyMCE update changes, this hack will be lost.
Link to that issue
My issue
I live in Japan and the companies I work for... their default "bullet" is a dash. All of them. I don't know why. Like this:
Support Business by providing IT service and deeply involved in the process of the system solution:
- Understand the company’s prior strategy
- Studying business benefit (ROI)
TinyMCE does not allow any customization of the list or advanced list plugins as far as what html gets inserted into the document. If I could I would just set a class on all the different bullets, or even better, create a new bullet type for the list type. But as far as I can see, it's just not possible. (If anyone knows how to customize lists in TinyMCE short of editing the source, please please please tell me!)
My Fix
I made the dash the Default:
In the site html and the Tiny editor I use the class 'order-wrapper' around anything with the bullets and in the editor I have: body_class: 'order-wrapper',
This css makes any UL with no 'list-style-type' be indented like a bullet list and have a dash-like bullet:
.order-wrapper ul:not([style*='list-style-type']) {
list-style: none;
margin-left: 0;
padding-left: 3em;
}
.order-wrapper ul:not([style*='list-style-type']) > li:before {
display: inline-block;
content: "-";
width: 1.5em;
margin-left: -1.5em;
}
But when word document dashed bullets are pasted they include a dash so I end up with:
-- Understand the company’s prior strategy
So to get rid of the dashes at the beginning of the lines I added code in the editor init to remove the - at the beginning of a line if it's pasted as a list element. (There's probably a better way to filter that, so if anyone has a better way, please let me know):
init_instance_callback: function (editor) {
//On Paste: remove the dash from the beginning of li elements.
editor.on('PastePreProcess', function (e) {
e.content = e.content.replace(/<li>- /g, "<li>")
});
},
So if the user pastes any bullet from Word it will become a dash bullet list (default). Then they can highlight the list and choose circle, disc, or square to get the other bullet types.
Accoring to the tiny-mce documentation you can only define a single comma-separated string of values like "default,circle,disc,square" to advlist_bullet_styles.
Further more you can define non-standard conforming values as well (e.g. arrow):
tinySetup({
selector: "textarea",
plugins: "advlist",
advlist_bullet_styles: "default,arrow"
});
Based on this setup, you won't get a class name but you can apply a dirty css selector to achieve styling:
ul[style="list-style-type: arrow;"] li{
list-style-type: none;
list-style-image: url(list-icon-arrow.png);
}
My solution (18.11.2022) is the following:
In the appsttings.json set the following lines:
"RichTextEditor": {
"Commands": [
your commands here... as array of objects { "alias": "yourAlias", "name": "yourName", "mode": "rteMode like Insert"}
],
"CustomConfig": {
"image_advtab": "true",
"advlist_bullet_styles": "default,circle,disc,square,checkmark"
}
}
This appears then in your RTE in Umbraco:
see the image sample
And then you can add your own CSS in order to style this custom checkmark:
/* Umbraco 9 - custom style for bullet list */
ul[style='list-style-type: checkmark;'] li {
list-style-type: none;
font-family: "Fontawesome";
padding-left: 5px;
}
ul[style='list-style-type: checkmark;'] li::marker {
content: "\f00c";
font-size: 16pt;
color: #f52d00;
}
:: marker ist the custom checkmark element, it is in my case fontawesome icon - so I can style it much better as if I could use any .png images instead if icon.
Related
CSS Remove selection/active highlight border color from SIDR mobile menu
I've been trying to figure out how to remove the highlight color from my mobile menu. In the image below you can see the white highlight around home. The highlight moves to whatever is clicked on. When a new page opens, the highlight is just a white line below the 'close' X in the top right. https://i.stack.imgur.com/CT4Zd.png https://i.stack.imgur.com/IYp2Q.png I've been trying to set the border to 'none' for links on the menu or just to turn the border color to 006680 to match the background of the menu. Nothing seems to work. .sidr-class-dropdown-menu li a, .sidr-class-fs-dropdown-menu li a { padding: 7px 20px; font-family: "Alegreya SC"; font-size: 20px; font-weight: 500; text-align: center; line-height: 1.5; height: 100%; border: none; border-color: #006680; } .sidr-class-dropdown-menu li a::selection, .sidr-class-fs- dropdown-menu li a::selection { border: none; border-color: #006680; } .sidr-class-dropdown-menu li a:active, .sidr-class-fs-dropdown-menu li a:active { border: none; border-color: #006680; } .sidr-class-menu-link { border: none; border-color: #006680; }
Unwanted line breaks added wrongly in outlook
I am sending emails through a java program using velocity template. When I open my email in Papercut, the render is looking good but when I open the same email with Outlook, I have a lot of unwanted line breaks. I have modified the CSS in many ways like adding a specific width for table tag etc, I can see my modifications applied in Papercut but nothing in Outlook in terms of width. PapercutRender1 OutlookRender1 Here the Html template: <!doctype html> <html> <head> <meta name="viewport" content="width=device-width" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>My text </title> <style> /* ------------------------------------- GLOBAL RESETS ------------------------------------- */ img { border: none; -ms-interpolation-mode: bicubic; max-width: 100%; } body { background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; } table { border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; } table td { font-family: sans-serif; font-size: 14px; vertical-align: top; } /* ------------------------------------- BODY & CONTAINER ------------------------------------- */ .body { background-color: #f6f6f6; width: 100%; } /* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */ .container { display: block; Margin: 0 auto !important; /* makes it centered */ max-width: 580px; padding: 10px; width: auto !important; width: 580px; } /* This should also be a block element, so that it will fill 100% of the .container */ .content { box-sizing: border-box; display: block; Margin: 0 auto; max-width: 580px; padding: 10px; } /* ------------------------------------- HEADER, FOOTER, MAIN ------------------------------------- */ .main { background: #fff; border-radius: 3px; width: 100%; } .wrapper { box-sizing: border-box; padding: 20px; } .footer { clear: both; padding-top: 10px; text-align: center; width: 100%; } .footer td, .footer p, .footer span, .footer a { color: #999999; font-size: 12px; text-align: center; } /* ------------------------------------- TYPOGRAPHY ------------------------------------- */ h1, h2, h3, h4 { color: #000000; font-family: sans-serif; font-weight: 400; line-height: 1.4; margin: 0; Margin-bottom: 30px; } h1 { font-size: 35px; font-weight: 300; text-align: center; text-transform: capitalize; } p, ul, ol { font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px; } p li, ul li, ol li { list-style-position: inside; margin-left: 5px; } a { color: #3498db; text-decoration: underline; } /* ------------------------------------- BUTTONS ------------------------------------- */ .btn { box-sizing: border-box; width: 100%; } .btn > tbody > tr > td { padding-bottom: 15px; } .btn table { width: auto; } .btn table td { background-color: #ffffff; border-radius: 5px; text-align: center; } .btn a { background-color: #ffffff; border: solid 1px #3498db; border-radius: 5px; box-sizing: border-box; color: #3498db; cursor: pointer; display: inline-block; font-size: 14px; font-weight: bold; margin: 0; padding: 12px 25px; text-decoration: none; text-transform: capitalize; } .btn-primary table td { background-color: #3498db; } .btn-primary a { background-color: #3498db; border-color: #3498db; color: #ffffff; } /* ------------------------------------- OTHER STYLES THAT MIGHT BE USEFUL ------------------------------------- */ .last { margin-bottom: 0; } .first { margin-top: 0; } .align-center { text-align: center; } .align-right { text-align: right; } .align-left { text-align: left; } .clear { clear: both; } .mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .preheader { color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0; } .powered-by a { text-decoration: none; } hr { border: 0; border-bottom: 1px solid #f6f6f6; Margin: 20px 0; } /* ------------------------------------- RESPONSIVE AND MOBILE FRIENDLY STYLES ------------------------------------- */ #media only screen and (max-width: 620px) { table[class=body] h1 { font-size: 28px !important; margin-bottom: 10px !important; } table[class=body] p, table[class=body] ul, table[class=body] ol, table[class=body] td, table[class=body] span, table[class=body] a { font-size: 16px !important; } table[class=body] .wrapper, table[class=body] .article { padding: 10px !important; } table[class=body] .content { padding: 0 !important; } table[class=body] .container { padding: 0 !important; width: 100% !important; } table[class=body] .main { border-left-width: 0 !important; border-radius: 0 !important; border-right-width: 0 !important; } table[class=body] .btn table { width: 100% !important; } table[class=body] .btn a { width: 100% !important; } table[class=body] .img-responsive { height: auto !important; max-width: 100% !important; width: auto !important; } } /* ------------------------------------- PRESERVE THESE STYLES IN THE HEAD ------------------------------------- */ #media all { .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } .apple-link a { color: inherit !important; font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important; line-height: inherit !important; text-decoration: none !important; } .btn-primary table td:hover { background-color: #34495e !important; } .btn-primary a:hover { background-color: #34495e !important; border-color: #34495e !important; } } </style> </head> <body class=""> <table style="width:560px;" border="0" cellpadding="0" cellspacing="0" class="body"> <tr> <td> </td> <td class="container"> <div class="content"> <!-- START CENTERED WHITE CONTAINER --> <table style="width:560px;" class="main"> <!-- START MAIN CONTENT AREA --> <tr> <td class="wrapper"> <table style="width:560px;" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <!--<img src="http://localhost:8080/wmm-admin/icons/spidex-wmm_original.png" style="width:65%" /> --> <br/> <br/> <p><b>Webb, however, is 100 times more powerful than astronomy's godfather of space telescopes and can peer much deeper into space. Hubble studies the universe predominantly at ultraviolet and optical, or visible, wavelengths, which is the same type of light we detect with our eyes. Webb, on the other hand, is set up to specifically look in the infrared, which is invisible to our eyes but allows it to identify the glow from the most distant objects in the universe. It works in much the same way night vision goggles use thermal imaging technology to capture infrared light. Because the universe is expanding, just about all of the galaxies that we see from Earth are moving away from us. This means that to us, their light appears to have a longer wavelength, or a redshift. For very distant objects, this red shift is so large that they can only be observed in the infrared spectrum, which is where Webb comes in, while Hubble focuses on ultraviolet light. For this reason, the two will work in tandem for a while so that scientists can analyse the data provided by both to help advance our knowledge of the cosmos and how humans first came to be. Webb began development in 1996 and was originally envisaged to launch in 2007, but a major redesign in 2005 put this back and a series of further delays led to it eventually making it to orbit at the end of last year. THE JAMES WEBB TELESCOPE The James Webb telescope has been described as a 'time machine' that could help unravel the secrets of our universe. The telescope will be used to look back to the first galaxies born in the early universe more than 13.5 billion years ago, and observe the sources of stars, exoplanets, and even the moons and planets of our solar system. Webb, however, is 100 times more powerful than astronomy's godfather of space telescopes and can peer much deeper into space. Hubble studies the universe predominantly at ultraviolet and optical, or visible, wavelengths, which is the same type of light we detect with our eyes. Webb, on the other hand, is set up to specifically look in the infrared, which is invisible to our eyes but allows it to identify the glow from the most distant objects in the universe. It works in much the same way night vision goggles use thermal imaging technology to capture infrared light. Because the universe is expanding, just about all of the galaxies that we see from Earth are moving away from us. This means that to us, their light appears to have a longer wavelength, or a redshift. For very distant objects, this red shift is so large that they can only be observed in the infrared spectrum, which is where Webb comes in, while Hubble focuses on ultraviolet light. For this reason, the two will work in tandem for a while so that scientists can analyse the data provided by both to help advance our knowledge of the cosmos and how humans first came to be. Webb began development in 1996 and was originally envisaged to launch in 2007, but a major redesign in 2005 put this back and a series of further delays led to it eventually making it to orbit at the end of last year. THE JAMES WEBB TELESCOPE The James Webb telescope has been described as a 'time machine' that could help unravel the secrets of our universe. The telescope will be used to look back to the first galaxies born in the early universe more than 13.5 billion years ago, and observe the sources of stars, exoplanets, and even the moons and planets of our solar system. End test:</b> <i>The identified trigger result is higher than the set value.</i> </p> </td> </tr> </table> </td> </tr> <!-- END MAIN CONTENT AREA --> </table> <!-- START FOOTER --> <div class="footer"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td class="content-block"></td> </tr> </table> </div> <!-- END FOOTER --> <!-- END CENTERED WHITE CONTAINER --> </div> </td> <td> </td> </tr> </table> </body> </html> On the other hand, If I put this text instead, I have no unwanted line break neither in Papercut nor in Outlook: PapercutRender2 Outlook2 Do you have any idea of how I can get a correct render in Outlook ?
I found out the origin of the problem. I removed the "width: auto !important;" line from the .container class settings: Before .container { display: block; Margin: 0 auto !important; /* makes it centered */ max-width: 580px; padding: 10px; width: auto !important; width: 580px; } And after correction: .container { display: block; Margin: 0 auto !important; /* makes it centered */ max-width: 580px; padding: 10px; width: 580px; } Then it worked.
Change the background color of calender in react-datepicker
I have to change the background-color of the popper(which is calender) in my react-datepicker to black with white font color when I toggle the theme from default(white) to black. I have tried using popperClassName, but unable to pass in the font color and background color, although my placeholder has accepted the given values and changed its background when theme is toggled. I have to achieve the styles inline (JSS - css in js/jsx) way only ! though I have tried the styling of placeholder externally. <DatePicker selected={startDate} dateFormat={DATE_FORMAT} showMonthDropdown showYearDropdown isClearable todayButton="Today" popperClassName={{ color: fontColor, background }} placeholderText="Click to select date" className={background === '#303030' ? 'placeholderTable' : ''} onChange={(date) => { date = moment(date).format(DATE_FORMAT) if (date === 'Invalid date') { // this means that the user deleted the date // this.setState({ start_date: undefined }) this.handleChange({ start_date: undefined, temp_end_date: undefined }) } else { // this.setState({ start_date: date }) this.handleChange({ start_date: date, temp_end_date: moment(date, DATE_FORMAT).add(1, 'year').format(DATE_FORMAT) }) } }} /> I expect some way to modify the styling for the popper using popperClassName or any other way.
I needed the same thing and this is how I solve it - using css: .react-datepicker__header { text-align: center; background-color: #3e82cf; border-bottom: 0px; border-top-left-radius: 0; border-top-right-radius: 0; padding-top: 8px; position: relative; } .react-datepicker__today-button { background: #3e82cf; border-top: 0px; cursor: pointer; text-align: center; font-weight: bold; padding: 5px 0; clear: left; } For the calendar area you can use: .react-datepicker { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.8rem; background-color: #a66; color: #000; border: 0px; border-radius: 0; display: inline-block; position: relative; } Just create CSS file and import it. It should work. More styles you can find in react-datepicker.css in dist folder.
Font Awesome and CSS pseudoelements - some unicode characters don't work
I'm using FA and :before to use icons instead of bullets. Some unicode characters work, and some don't. For example, f004 (heart), f005 (star), and f2dc (snowflake) work. But f001 (music), f008 (film), and f046 (check) don't work. I'm using FA 5.0.6 Free. #font-face { font-family: 'awe506'; src: url("../fontawesome506/fa-regular-400.eot"); src: url("../fontawesome506/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../fontawesome506/fa-regular-400.woff2") format("woff2"), url("../fontawesome506/fa-regular-400.woff") format("woff"), url("../fontawesome506/fa-regular-400.ttf") format("truetype"), url("../fontawesome506/fa-regular-400.svg#fontawesome") format("svg"); } .bulletsamples ul { list-style-type: none; padding-left: 0; margin-left: 2em; } .bulletsamples li { position: relative; padding-left: 2em; margin-bottom: 10px; } .bulletsamples li:before { position: absolute; top: 0; left: 0; font-family: awe506; font-weight: 400; font-style: normal; font-variant: normal; text-rendering: auto; -webkit-font-smoothing: antialiased; } .stars li:before { content: "\f005"; /*THIS WORKS*/ color: blue; } .stars li:before { content: "\f008"; /*THIS DOESN'T WORK*/ color: blue; } No - I don't have two .stars li:before rules in my CSS - I've added this for illustration. On the FA website (https://fontawesome.com/icons?d=listing&m=free) I filtered the list to only show icons included in the free set. Also - the icons are hollow - I followed the instructions on FA's site and set font-weight to 900 for solid icons and it made no difference. Thanks in advance - Cath
Doesn't look like u+f008 has a glyph in that font/version; it is simply not present. According to https://fontawesome.com/icons?d=gallery&q=film you would need to use the solid version instead of the regular one (which is "Pro" only). This goes for u+f001 as well. u+f046 has apparently been moved at some point to u+f14a. <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <style> #font-face { font-family: awe506; src: url(fa-solid-900.woff); } .stars { font-family: awe506; } .stars li:before { /*content: '';*/ content: '\f005'; color: blue; } .stars li:after { /*content: '';*/ content: '\f008'; color: blue; } </style> </head> <body> <ul class="stars"> <li>foo</li> <li>bar</li> </ul> </body> </html>
CSS horizontal menu breaking when zooming Chrome / Safari
I read many similar topics and I tried the suggestions but it seems I can't get this to work. I am a self-learner, not a professional just building a website for my parents company and I am having a problem with my menu. This is working fine in IE and Firefox (at least the versions I have) but Chrome and Safari don't like it. Initially in Chrome it looks good but if you zoom out it's breaking and in Safari for iPhone and iPad it's even worse as the last item on my list is never inline with the rest. What I read is that I need to to have white-space:nowrap; in my code and I do but it's not helping, I was playing with the position attribute as well but none of the values work. Maybe one strange thing about my menu is that each li has an id tag but that's because I want a different image to hover over each item and that's the way I could thing of doing it. I would really appreciate some help, Thanks Link to the website and code below:http://redcoral-catering.com/index_catering_redcoral.php Safari iPhone: HTML: <div id="navbar"> <ul> <li id="zero"> за нас</li> <li id="one"> услуги</li> <li id="two">нашата кухня</li> <li id="three" >галерия</li> <li id="four">филми</li> <li id="five">кой се е хранил при нас? </li> <li id="six">контакти </li> CSS: #navbar { width: 894px; height: 57px; margin: 0px auto; padding-left:25px; padding-top:1px; /*clear:both;*/ white-space:nowrap; } #navbar ul { font-family: Arial, Verdana; font-size: 14px; list-style: none; margin: 0; padding: 0; width:100%; } #navbar ul li { /* display: block; */ display: inline-block; position: relative; float: left; /* border-right: 1px solid #1A1A18;*/ } #navbar ul li ul { display: none; } #zero{ background-image: url(images/menu/short.png); } #one{ background-image: url(images/menu/short.png); } #two{ background-image: url(images/menu/short.png); } #three{ background-image: url(images/menu/short.png); } #four{ background-image: url(images/menu/short.png); } #five{ background-image: url(images/menu/short.png); } #six{ background-image: url(images/menu/short.png); } #seven{ background-image: url(images/menu/short.png); } #navbar ul li a { display: block; height: 42px; text-decoration: none; text-align: center; text-transform: uppercase; font-family: Calibri, sans-serif; font-size: 13px; font-weight: bold; color: #851212; border: none; padding: 10px 28px 5px 28px; } #zero a:hover { background-image: url(images/menu/22.png); } #one a:hover { background-image: url(images/menu/22.png);} #two a:hover { background-image: url(images/menu/24.png);} #three a:hover { background-image: url(images/menu/22.png);} #four a:hover { background-image: url(images/menu/22.png);} #five a:hover { background-image: url(images/menu/23.png);} #six a:hover { background-image: url(images/menu/26.png);} #navbar ul li a:hover { color: #DF0101;}
Try applying the following settings: html, body { margin:0; padding:0; } #navbar { width: 857px; /* updated width to center properly */ height: 57px; margin: 0px auto; /*padding-left:25px;*/ padding-top:1px; white-space:nowrap; } #navbar ul li a { display: block; height: 42px; text-decoration: none; text-align: center; text-transform: uppercase; font-family: Calibri, sans-serif; font-size: 13px; font-weight: bold; color: #851212; border: none; padding: 10px 26px 5px 26px; /* decreased padding very slightly */ } Also try placing this meta tag in your header: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> Let me know if that solves the issue.