Facebook custom style: visibility hidden works, display none doesn't - css

I'm trying to write a custom style sheet to rename Facebook Groups in the left sidebar. I am not an admin of the groups and cannot change the names, I just want to read something there that is meaningful to me, especially when many group names begin with the same words and appear the same in the sidebar list.
What I try to do is hide the original name and insert my custom name.
I can insert my custom group name with something like:
#navItem_group_136453550474635 a div:nth-child(2):after{
content: "Custom name";
}
Unfortunately I cannot "shrink" the div with the original name with "display:none", only hide it, so that in effect there is some empty space pushing my custom name to a second line.
This works:
#navItem_group_162405550444366 a div div{
visibility: hidden;
}
This does not work:
#navItem_group_162405550444366 a div div{
display: none;
}
"display:none" does not work, presumably because the div already has display:block, but why doen't my browser style sheet overwrite that?
I'm using safari under OS 10.8.?, but I believe this shouldn't make a difference.

"display:none" does not work, presumably because the div already has display:block, but why doen't my browser style sheet overwrite that?
Does your rule have the same specifity as the one Facebook is using to format this element?
Have you tried adding !important to your declaration, to overwrite the formatting of Facebook’s own stylesheet?

Related

How to add this weird CSS styling

I was trying to add some css styling to my wordpress website. However, I'm quite confused how to select the element and add the css !
Let me explain it in detals in three scenarios:
Picture 1:
I'm going to change the color and width of that button with text "Submit your attendance" inside. I wanted to make it red.
First Try: Picture 2:
I selected the calss which is :
wpcf7-form-control wpcf7-submit
Added the background-color: red , but it didn't work.
Second Try: Picture 3:
I did the same for this class:
wpcf7-form-control
Thrd Try: Pictur 4:
In inline style, when I add background-color: red and width: 100% in workes. I noticed a style attribute is also added. However, I'm not sure how to add in my Custom CSS of wordpress. I mean which element should I select? Of course Inline-style is not an element.
This is not an issue with regard to WordPress. This is due to CSS Specificity. What this means is that the rule that is more specific will "win" and be applied. This is why inline styles typically work over non-inline styles.
In your example, the rule that is being applied is more specific than the one you're trying to override with.
There is a hierarchy when it comes to specificity and the order in which rules are applied. Here they are in order of most specific to less:
Inline Styles
Ids - targeting the ID of an element is more specific than targeting a class
Classes, attributes and pseudo-classes (for example :hover)
Elements (for example a "p" tag) and pseudo-elements (:before)
Either add an ID for the your button or target the class in a more specific manner. For example body .thecontainer .thediv .anothercontainer .myelement
This might be work. You need to add !important property.
wpcf7-form-control{ background-color:red !important; }
Try this.
To update worpress css you have to edit the file style.css
Appearance -> Editor -> style.css (search inside other files)
or
Appearance -> Customize -> Additional CSS (where you have to add manually every line of code)
Sometimes you need to add "!important;" at the end of line, something like:
background-color: red!important;

display: none in <iframe> specific element

In my html webpage I insert an iframe
but in this iframe bottom show a div which's class name mobile-desktop-link
So you want to hide the "view web version" link? Alright, than you can use this:
.mobile-desktop-link a.home-link { display: none; }
Add this to your stylesheet and you are ready to go. Of course this is only possible if the iFrame is on your domain. If you have tried the snippet I shared here above, with or without !important statement and it did not work? Well than, you can't remove it.

On off checkbox styling

I'm trying to turn a brand new template into my login script and for some reason the text "ON" for the checkbox isn't aligned properly like the template is as well as there doesn't seem to be a right border when on is selected. I've been trying to match up the elements and css to troubleshoot but not having any luck.
http://www.kansasoutlawwrestling.com/kowmanager/login
http://themeforest.net/item/zice-admin-colorful-admin-templates/full_screen_preview/1980638
I tried changing the padding as suggested by the two people below but I'd rather not change the css because it works on the template shouldn't it work without changing the css on mine.
Any other ideas?
I'm hoping someone sees something.
There's a 13px padding set on the span. Remove it and it will align properly.
It's on line 1187 of your zice.style.css file:
label.iPhoneCheckLabelOn span {
padding-left:13px
}
Change this declaration to this value:
label.iPhoneCheckLabelOn span {
padding-left: 1px;
}

Ignore previous css definitions

I'm developing an add-on for an existing CMS system. My add-on outputs a link to a style sheet and then outputs a table. The rest of the content(header,left column, footer etc.) is provided by the CMS.
Previously linked CSS styles seems to effect the way my table is displayed. I want to avoid this. I want my table to be shown according to my CSS style. How can I this?
You can add the !important declaration to your style:
table thead th
{
color: #ff0000 !important;
}
Your column headings should have red text now, even if another color has been previously set through another style.
There are only two options:
1) Put the table and its stylesheet in an iframe. Since it is a separate webpage entirely, it won't be affected by stylesheets on the parent webpage.
2) Fully specify the styles of all elements on your table. As long as you override everything the parent page might have specified, your table will look as you want it to.
do you mean a CSS reset? google that for thousands of results.

How to style content of pages without adding css class to element?

I use CMS for client and client doesn't know CSS he use WYSIWYG editor to put content in pages. Client adds Paragraphs, images, images in paragraph (left or right floated), ordered and unordered list, Tables. Problems comes when he want to add images in paragraph (left or right floated). and without adding css class it's not possible. And i don't want to add <div> in content because WYSIWYG editor can't manage div and client works in WYSIWYG mode.
How to style content of pages without using css class?
You will need your user to add a CSS class/style attribute to the image somehow - without adding something to the image to tell it to float right or left it won't float right or left.
If your question is how the client can add the class without having to manually edit the HTML I reckon the only way is to dive into the WYSIWYG editor's javascript and write something a bit like this towards the end of the image-adding process:
var alignment = prompt("Type l to align the picture to the left, and r to align the picture to the right","l").strToLower();
if(alignment == 'r')
{
//line of code to add class "right" to the image tag
} else {
//line of code to add class "left" to the image tag
}
What the code to add the classes should depend on how the WYSIWYG editor works
You can try using element selectors or ID selectors to add styles to HTML elements without referencing CSS class in them.
Element selector would add border to all images on the page:
img { border:1px; }
ID selector would do the same only to image with ID 'image1':
img #image1 { border:1px; }
Still you will need to reference the stylesheet from your page.
There are lots of different ways you can make CSS Selectors that don't require CSS classes. For example, to make a rule that applies to all img tags inside p tags, you could write this:
p img { float: left; }
But how are you hoping to determine which images need to be right-aligned and which images need to be left aligned? Does that data exist in the document in any machine readable format?
A WYSWYG should have "align" property for an image (at least those I have seen). You can then use CSS attribute selector img [align=left] { float:left; } or img [align=right] {float:right;} This wont work on IE 6,7 though, you can use JavaScript to mimic this for those browsers.

Resources