I have some CSS added to support a table that looks like this:
#outertable {
background-color: #000000 !important;
border: 40px black solid !important;
}
#innertable {
background-color: #000000 !important;
border: 20px #A67100 solid !important;
}
#innertable td {
background-color:#F1F1D4 !important;
border: 2px #A67100 solid !important;
}
When I use the above CSS in a stand-alone HTML page, it works fine. There is no other CSS, so there are no conflicts. However, when I incorporated the above CSS into a Joomla template there is a problem, that Table's cell doesn't include what is expected. I used Inspect in Google Chrome web browser and identified the source of the problem. Here is the CSS that's causing the problem to the above CSS:
table, table td {
border-collapse: collapse;
}
While in Inspect in Chrome I can uncheck the box for this CSS code and the page looks like expected. The CSS for this is coming from com_content.css. But I don't want to override this CSS for the entire website, just for the table it's being used in on this specific Joomla web page of the site.
How can I incorporate the above CSS into the CSS at the top of this posting so it has the same effect that unchecking it does in Chrome's Inspect, but only on this table on this web page of Joomla?
I have tried adding a 'border-collapse:separate', but it doesn't do anything:
#innertable td {
background-color:#F1F1D4 !important;
border: 2px #A67100 solid !important;
border-collapse:separate !important;
}
I'm not a CSS expert by any means, so I would greatly appreciate help on this. Thanks!
The border-collapse property affects tables only, not cells, so you need to set it on the table element:
#innertable { border-collapse: separate }
You should also consider using selectors and named HTML elements so that you can apply styles on a per element basis
Related
I am creating a website and I used google custom search for it. When I trying to add a border for th, td they also applied for my GCSE. It looks ugly when it appears there. I am trying to figure out how can I use my CSS code all table except google custom search. Here is my website, https://vendabariulo.gov.bd/citizen-charter/
Here is my code,
th, td {
text-align: left;
padding: 8px;
border: 1px solid #ddd;
}
Here is my search button screenshot, there shows a border around it. If I remove border from th, td it looks beautiful.
enter image description here
You could try to style the Google Custom Search itself.
This rule might help you
gsc-search-box th, gsc-search-box td {
/* apply your rules here as you like.
For example, border:none; */
}
Thanks all. After thinking and trying half an hour, I figure out something. It's work for me. I think it's a valid CSS rule.
I add a div class to my google custom search code and add this simple code,
.gcse td, th, tr {
border: none;
}
Use :not() CSS pseudo-class as doctrine in developer.mozilla.org
table:not(table.gsc-search-box){
/* your style definition */
text-align: left;
padding: 8px;
border: 1px solid #ddd;
}
Hope it helps.
I'm trying to style tag in html using css. It works in Firefox properly but not in chrome. Here is the code i use in styling forms. After referring some through internet I used !important; command along with this style sheet. But it did not worked.
.style {
display: block;
border: none;
color: #333;
background: transparent;
border-bottom: 1px dotted gray;
padding: 5px 2px 0 2px;
width:300px;
font-size: 14;
color:#FFF;
}
.style:focus{
outline: none;
border-color: #51CBEE;
}
simply? you can't.
Firefox allows you to do some styling on a <select>, but is not consistence along browsers.
You should go for a JavaScript masking solution if you really want the <select> to be styled crossbrowser.
Maybe Chosen or Selectize can help you.
Unfortunately there isn't yet a cross-browser compatible route of styling form elements with CSS: it's not usually left to the designer to have control over their appearance/behaviour so form elements are notoriously difficult to style. Many browsers specifically do not allow you to style them at all!
If you need to get a consistent look across all browsers, the only route is to use JavaScript to replace the form element in-view with stylised HTML elements.
Here's an article that lists a few of the options available for you: http://www.jquery4u.com/plugins/10-jquery-selectboxdrop-down-plugins/
I am dynamically generating table with around 55 rows and 15 columns. I have set boder width of columns to 1px like this
#tblId td
{
border:1px solid #616161;
background-color:#EEEEEE;
}
But for some cells it show border thicker than 1px!
Here are the part of my table, you can see the difference in borders for upper columns and below columns
Edit
Here is the fiddle http://jsfiddle.net/bz3Da/2/
That is really strange that it is looking good in the fiddle but not at my end, I checked no other classes are affecting the table.
I reset the firefox zoom. It works!!!
perfect.
i found when i zoom in some border will be bold.
blow is my cssenter code here
firefox 50.1 / windows 7
table td, table th { border: 1px solid #e8e8e8;}
table {
border-collapse: collapse;
border-spacing: 0;
}
http://jsfiddle.net/bz3Da/4/
Add !important:
#tblId td
{
border:1px solid #616161 !important;
background-color:#EEEEEE;
}
Inline styles are more important than CSS styles.
You can override them, but you should avoid using !important - just remove inline styles and use CSS only.
Someone has already asked why here:
Should I avoid using !important in CSS?
The problem is that on my website http://dev.gratefulhearttherapy.org/, at least 2 css properties are not showing up as expected:
html {
background: #fff url('images/bg-top-honey-v3.0.jpg') top center repeat-x !important;
}
#bd img {
margin: 0;
padding: 4px;
border: solid 1px #D9D9D9;
}
One background image is missing, and pictures don't have the grey border they're supposed to have.
Yesterday night I was messing with 3 things in my code:
the css file typography-new2.css,
the PHP files elements meta.php, header.php, footer.php, and
the Google Analytics code.
I must have broken something but I can't find what. I tried to pass the website and the css through the W3C validators, I scrutinized the code with Chrome inspector, looking for unclosed tags and such, but didn't find anything.
When using the Chrome inspector, to look at the html element and the img's, the missing css seems absent - not only overridden, but absent.
Any help would be appreciated! With much gratitude.
The issues are in your stylesheet: typography-new2.css
Background not showing:
At the very top you have referenced img before html only separated by comments. So the html rule is actually being interpreted as img html {:
img /* REMOVE THIS LINE*/
/* #import url('http://dev.gratefulhearttherapy.org/themes/gratefulheart/tabs.css'); */
/* All CSS files above will be loaded from this single document. */
html {
margin: 0;
padding: 0;
/* background: #fff; #f9dc91 url(http://dev.gratefulhearttherapy.org/themes/gratefulheart/images/background-sandish-tile.jpg) !important; */ /* #F9D984; */ /* customize_background_color */
background: #fff url('http://dev.gratefulhearttherapy.org/themes/gratefulheart/images/bg-top-honey-v3.0.jpg') top center repeat-x !important;
}
Pictures missing grey border:
You have a line full of *s outside of the closing comment / right before the rule #bd img which is probably why the rule is not being applied.
/********************************
*********************************
* $$ GENERAL TYPES
********************************/
******************************** /* REMOVE THIS LINE */
#bd img {
margin: 0;
padding: 4px;
border: solid 1px #D9D9D9;
}
If you remove the two lines, I think all of your issues should be solved.
Your images are not a direct descendent of #bd, I think that is your problem the CSS code is fine. See #150poundsofdonamites response for the other issue.
If this still doesn't produce the desired result try changing html to body.
I've got a CSS conflict that's preventing me to set the width of a div and I'm really struggling to see where it is.
Can someone give me a hand?
It's this div here:
body.node-type-campaign #com_col_two {
width: 400px;
padding: 0;
border: 1px solid blue;
}
A link to the page: http://www.wdm.org.uk/test-campaign
Thanks!
Remove the inline-style width:auto; from <div id="com_col_two">
Have you tried just:
#com_col_two {
width: 400px;
padding: 0;
border: 1px solid blue;
}
And remove all the added properties on the <div> tag?
You have a lot of classes applied to the elements in your page.
Also, have you tried using Firefox with Firebug. I'm sure a lot of people would recommend using that.
Check out FF's Web Developer Toolbar or Chrome's Developer Tools: both have a CSS view which shows you which style definition affects this specific element (it is triggered by rightclick->Inspect element).