I want to use Angular Material's md-autocomplete in my angular application. I already have a modified css which my application is using. But adding the angular material css screws up my entire page.
I tried scoping the css to only that div. But still it somehow overrides the parent css also.
This is how I used the css in my page :
<div>
<style>
The whole Angular material css goes here.
(https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css)
</style
</div>
I thought the above would scope the css only to that div. But it somehow leaks to the other divs as well.
Also I tried to remove parts of the original css so that I leave only the styles that the md-autocomplete uses. But this is really tiring and also the results are not great as well.
Please help me how to use the md-autocomplete in my original html file.
what you are trying to do is not possible in css see below code
<div>
<style>
div{
color: red;
}
</style>
some text
</div>
<div>
<style>
div{
border: 1px solid brown;
}
</style>
another text
</div>
earlier it was possible in css with <style scoped> but support for this feature has been dropped.
<div>
<style scoped>
#import "style.css";
</style>
</div>
however you could use CSS preprocessor like less or sass
.your-class {
#include 'style.css';
}
for more details you can refer Link external CSS file only for specific Div
hope i answered your question
Related
I am trying to remove the inline style from the thumbnail navigator skin but am not sure how to treat this bit of html.
<!-- What is "div u=" please?
Is "u" a class here?
How does that translate to a CSS selektor? -->
<div u="slides" style="cursor: move;">
<!-- Here I can simply write ".p" as a CSS selektor?
How does the CSS selektor then know it
has to do with "u=prototype"? -->
<div u="prototype" class="p" style="POSITION: absolute; WIDTH: 72px; HEIGHT: 72px; TOP: 0; LEFT: 0;">
<!-- Here I can simply write ".i" as a CSS selektor?
How does the CSS selektor then know it
has to do with "u=thumbnailtemplate"? -->
<div u="thumbnailtemplate" class="i" style="position:absolute;"></div>
<div class="o">
</div>
</div>
</div>
So far I have never come across div u= in general or div u=slides, prototype, thumbnailtemplate, etc.
For better understanding, can one simply assign letters to divs and then assign those letters functions with jQuery? Where in your code is slides, prototype, thumbnailtemplate referenced? I would like to learn about this technique please. Can you provide a link or reference to this please?
Thank you for any help.
By the way, I have looked at a ton of sliders and finally choose this one. I am just about to start development with it and Bootstrap 3.3.2, I hope it will all work out.
Very NICE work from what I can see on the demos. They ALL work on my smartphone out of the pocket, something most of the other sliders did not manage. Well done!
If you don't mind me saying this, the only thing I would change is provide a folder "CSS" with only the CSS rules for the arrow-, bullet- and thumbnail- navigators, including the inline styles of the span, div=u and generally all elements that have inline styles.
Apart from that solid work. Thank you!
What is "div u=" please?
Re: There are so many elements in the slider, the 'u' attribute is customize attribute, jssor js library read 'u' attribute to identify the usage of an element.
Is "u" a class here?
How does that translate to a CSS selektor?
Re: 'u' is not a class. You can try $("div[u=slides]") to select the element in javascript. And you can add your own class as follows,
<div u="slides" class="yourclassname">
Here I can simply write ".p" as a CSS selektor?
Re: yes, you can. please use the following format to prevent conflicts from other sliders in the same page,
.jssort07 .p {
/* css */
}
.jssort07 .pav {
/* css when active */
}
.jssort07 .pdn {
/* css when mouse down */
}
.jssort07 .p:hover {
/* css when mouse over */
}
How does the CSS selektor then know it has to do with "u=prototype"?
Re: No need to think about it. The 'u=prototype' lets jssor js know it is the prototype element of thumbnails.
Here I can simply write ".i" as a CSS selektor?
Re: Yes you can. But please use the following format to avoid conflicts.
.jssort07 .p .i {
/* css */
}
.jssort07 .pav .i {
/* css when active */
}
.jssort07 .pdn .i {
/* css when mouse down */
}
.jssort07 .p:hover .i {
/* css when mouse over */
}
How does the CSS selektor then know it has to do with "u=thumbnailtemplate"?
Re: Please ignore it.
I have a division placed on the bottom of the page. I put an image into this division, but I don't know how to modify the image. The problem may be, that the inline style for <img> is setting modification rules for all images. I have an inline style sheet that has this code and HTML code for <div>.
My CSS code looks like this:
<style type="text/css">
img {
image-align: center;
padding: 10px;
height: 200px;
width: 140px;
}
div {
position: absolute;
right: 10px;
}
</style>
And my HTML code is like that:
<div align="center" >
<img src="images/music_banner.jpg" >
</div>
you can do this:
div img{
}
or give the div a name and do this
#div img{
}
or you give the img an id as below
<div>
<img id="mg"/>
</div>
Use id as #mg in CSS code.
or you can do as define class name in img tag.
<div>
<img class="mg"/>
</div>
Use class as .mg in CSS Code.
You might try learning a little bit more about CSS selectors: these are the rules that tell the browser which element you'd like to apply the following rules to.
I would recommend Code Academy for an easy to follow course. You can skip down to the CSS section if you are already comfortable with HTML.
Note: if you google CSS, you'll get "w3schools" as the first results. That website is generally derided on Stack Overflow. I don't know if it's really that bad, but I tend to skip it just because everyone else has a bad opinion of it. Your call if you find it helpful of course.
I should note that I like to use the W3C (World Wide Web Consortium) website for reference, as they're the ones trying to make everything standard. It is a pretty technical read, though.
Create a div element in your HTML code:
<div class="parent">
<img src="image">
</div>
Than add this to your CSS code:
.parent {
width: 42px; /* I took the width from your post and placed it in css */
height: 42px;
}
/* This will style any <img> element in .parent div */
.parent img {
height: 100%;
width: 100%;
}
Ok, so I'm brand new here (and to programming) and I'm not even sure If the questions I'm going to ask is worded correctly or makes sense, but here it goes.
I am working on a bootstrap theme for a client, I am trying to change the background colors. I do not want the page to be all the same background color. I would like certain rows to have a different background color from the rest of the page. How can I accomplish this? I've tried adding unique tags to the containers I'm working on with the background color I want, but no matter what I do NOTHING is changing. I know this is something simple and I just need a simple explanation as to how to make this work! HELP!
You have some options to do that.
For the background in the divs:
You can do:
<head>
<style>
body{
background-color: red;
}
.backg1{
background-color: blue;
width: 100%;
padding: 10px;}
.content{
background-color: white;
margin: 10px;
width: 80%;
height: 100px;}
</style>
</head>
<body>
<div class="backg1">
<div class="content">
</div>
</div>
</body>
Is only work with the css properties. You need paste the code to try help you.
Add class="bgColor"
Like:
<div class="bgColor">
....
</div>
Your css:
.bgColor{
background: #dadada;
}
Give all your styles in custom_style.css, in which you can add CSS properties for elements. Inside your custom_style.css you give background color you want.That's it, Its just the work of CSS. No other process or procedure to .
consider #Page 1
/* Include Bootstrap.css and custom_style.css etc */
<body>
<div class="container">
<div id="Web_page_home">
.............
</div>
</div>
/* include JQuery.js and Bootstrap.js */
Consider #page 2
/* Include Bootstrap.css and custom_style.css etc */
<body>
<div class="container">
<div id="Web_page_about">
.............
</div>
</div>
/* include JQuery.js and Bootstrap.js */
Here goes the working of CSS "Custom_style.css" has
#Web_page_home { background-color:red; }
#Web_page_about{ background-color:green; }
The output will b the Page 1 backgorund will b in red and another page 2 will be in green.
if you didn't understand still i will attach fiddle.
I'm just new to CSS and I want to run this particular animation but not sure yet how to call it in my html file
http://www.impressivewebs.com/demo-files/css3-animated-scene/
Type in the CSS code in a file named `style.css
Then include it as shown:
<link rel="stylesheet" href="style.css">
Place style.css and a HTML page, for examplepage.html in the same folder and open `page.html. Should work :)
I have set up a JS fiddle for you:
http://jsfiddle.net/kr2XU/
You have to link your CSS in the HTML file like this:
<link rel="stylesheet" href="style.css">
For the future, you should know very easy and good way of animating content in your HTML files is using an Adobe product called Edge Animate. It is available with a free Creative Cloud membership.
You can learn more about it here.
About calling CSS selectors, let's have an example:
main.css
.class1
{
background-color: #fff;
border: 1px solid #000;
}
#another_selector
{
background-color: #eee;
border: 1px solid #666;
}
In your HTML file, you will have:
<div class="class1"> This div has the CSS class ".class1" </div>
<div id="another_selector"> This div has the "#another_selector" id </div>
See here a JSFiddle that will help you figure out what's going on with those classes and ids.
I am redesigning a wordpress blog.There are 5 different pages and i want to use different background images on each of them. Is there any way to do this?
And,i don't want to change the background element. I want to change the background image of the #main element in my css..
I already have a css file so will overwriting the same elements using php affect anything?
Any help will be appreciated...Thanks
Each page or post will have a different class on the body, ie.
page-id-1234
post-id-4567
You can use this to your leverage inside your CSS file:
body {
background: url('home.jpg');
}
body.page-id-1234 {
background: url('page-1234.jpg');
}
body.post-id-4567 {
background: url('page-4567.jpg');
}
You could give each div#main (I assume it's a div) another class. So
<div id="main" class="pageOneBackground">...
<div id="main" class="pageTwoBackground">...
etc...
Then remove the background-img from the div#main and apply individual background-imgs to each new class.
This won't affect the php.
You can change the background with CSS/URL of image to apply to only the background of the post, only on the background of the home/main page, or both pages. http://wordpress.org/plugins/custom-post-background/screenshots/
If only only need to do it for 5 pages, set the main items of the body in your main CSS, for example:
body {
background-repeat:none;
background-position: center top;
etc...
Then on each page just add:
<style type="text/css">
body {
background-image:url(/images/background1.png);
}
</style>
You can also see this on the source of this page.