Overriding CSS with Custom CSS Issue Sharepoint 2010
I am trying to override this in webpart <font color="black" face="Calibri" size="2">.  New to CSS, how can I change it in my css or remove it.  It is inclosed
January 11th, 2014 4:56am

Your CSS selector needs to be as precise as possible, so if your DIV has an ID or a CSS class then you select the DIV and the included FONT tag. Example:

   <div id="xyz"><font ...

then you could select this with:

#xyz font  { yourNewCSS }

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 5:29am

That is the problem the webpart div id or class is not specified.

<div>

<font color="black" face="Calibri" size="2">

Can the webpart code be changed in the html editor. 

January 11th, 2014 6:22am

hello,

mike smith has given you the suitable answer and if still it didn't over ride

<div id="abc">

<font>

</div>

<style>#abc{

color:black !important;}

</style>

using !important we can override.

thanks

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 7:47am

Thought I would give you a screenshot.

The div does  not have a class.  I have tried using the div class ms-rtestate-field does not work in my custom css. Note again this is in a WebPartWPQ4.   

January 11th, 2014 5:54pm

Hi,

Add the below CSS to your webpart,

.ms-rtestate-field div

{

font-size:8px !important;

font:arial !important;

}

It should work!!! Cheers !!!

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 6:41pm

Okay still new to SharePoint,   am not sure where in the webpart I am to add this snippet of code.  In my custom css I added this and still not working.


#MSOZoneCell_WebPartWPQ4 .ms-rtestate-field div

{

font-size:12px !important;

font:arial !important;

}

I think maybe something in my custom css is blocking this.  

January 11th, 2014 7:07pm

You add only the below snippet,

.ms-rtestate-field div

{

font-size:12px !important;

font:arial !important;

color:red !important;

}

Don't mention #MSOZoneCell_WebPartWPQ4 before class name.

Please add the above CSS class without changing anything.

I have added font color as Red just to confirm whether our custom css has applied.

Regards,

Krishna

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 7:19pm

Well I tried that and  it changed things but not the area I need.  I will keep looking to see  what is going on.
January 11th, 2014 7:33pm

That's really good.

if you can share your screenshot, i can help you more...

Regards,

Krishna

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 7:44pm

The screen shot is in the email string.
January 11th, 2014 7:45pm

can you share your screenshot... where it is suppose to apply and where it got applied?


Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 7:48pm

Sure

January 11th, 2014 7:50pm

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 7:52pm

Okay this page has the webpart.  Notice the text is extremely small.  Previously before I altered the view the font size was correct.
January 11th, 2014 7:53pm

you want to change the font and font size to the text which is there in Summary box?

also, summary box it self a separate webpart?

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 8:01pm

Yes in the summary box the font size as well as make the text color blue family arial.  The summary box is a separate webpart.
January 11th, 2014 8:04pm

well... you have to add the below code in the summary webpart,

In Summary webpart, add the CSS in html. It should look like as below,

<html>

<head>

<style type="css\style">

**** CSS code here ****

</style>

</head>

<html>

if tag like head or style miss in your code, add the tags and add the below snippet in your summary webpart,

.ms-rtestate-field div, ms-vb2 .ms-rtestate-field div, ms-vb2 a .ms-rtestate-field div

{

font-size:8px !important;

font:arial !important;

font-family: verdana, arial, helvetica, sans-serif !important;

color:blue !important;

}

Regards,

Krishna

  • Proposed as answer by kmch2003 Saturday, January 11, 2014 5:16 PM
Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 8:15pm

Okay you keep stating add it in the webpart.  How do I do that. I see the Html source for the whole page.  Am I to add it there.
January 11th, 2014 8:24pm

you said summary is webpart. So is it OOB webpart or your custom webpart?

if it is your custom webpart, you can incorporate into your code.

if it is OOB webpart,  you can add to your custom master page.

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 8:29pm

Yes I added to my css page and it changes everything but what is in the webpart box.  I have referenced the webpart but still not working.
January 11th, 2014 8:38pm

Thanks for trying.
Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 8:40pm

can you tell me in details and helpful if you attach your screenshot...
January 11th, 2014 8:43pm

what screenshot are you talking about.  The screen shot of the webpart as well as the IE developer tool showing what I am trying to change is in this string.

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 8:45pm

Hi,

You've got the right idea above, but you need to drill down a little bit farther. Your CSS override needs to be added as close to the text as possible. So your CSS selector should look something like this:

#MSOZoneCell_WebPartWPQ4 .ms-rtestate-field div font

Adding the web part's ID is the best way to keep your change to only that one web part. You may need to do some trial and error to find the best sequence of selectors.

I see that you are using the F12 tools to inspect your HTML. Use the CSS option in that tool, click your text and in the right side CSS panel scroll to the bottom and notice that last CSS selector listed. That often is just what you need.

Which kind of web part are you using? You cannot add the CSS code directly to a list web part. You have a couple of choices:

  • Edit the page that contains the web part in SharePoint Designer and add your CSS just before the end tag of the PlaceHolderMain placeholder.
  • Add a Content Editor Web Part to your page and place it below the web part you want to change. You can either add the CSS directly to the CEWP or you can link to a text file stored in a library that contains the CSS (easier to maintain and reuse)

 

January 11th, 2014 8:49pm

Thanks Mike,  I have a css txt file attached in a content editor on the page.  I did not realize  I had to go that deep.

Wow that format is working.  I did have to add the wbp number.  Thank you all so much for being patient with me and for sharing the answer.  I learned a lot.

Free Windows Admin Tool Kit Click here and download it now
January 11th, 2014 8:59pm

One last thing.  Is there anyway to change the colors of the links in the webpart with the code that is there. 
January 13th, 2014 7:00am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics