How can I link css for specific element? - html

I copied this link: <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
This is for a slideshow in my HTML. But its effects are seen for the entire body. How can I use it only for the slideshow?

May be you can find your solution in this link:-http://qnimate.com/creating-a-slider-using-html-and-css-only/

You can't do that simply because you don't own the file, so you can't modify it.
That's sad for you but this file probably use "global" classes and you need to modify this file in order to delete all the body, p, div, ect... css classes so they will not affect your entire page anymore.
But, hey, I HAVE A SOLUTION for you, you see this link, yeah, this one: http://www.w3schools.com/lib/w3.css !
Just use it like any other link, you will see all the css stuff, you just need to put it in your own css file then modify it.
Hope that will help you.

Related

Adding a separate CSS file in the body

I have provided a template and it contains many CSS files in head and the body is divided into header ,content and footer portions. I want to add to add bootstrap in order to utilize its grid system for its content part. But when ever I add bootstrap.css in head above or below all the style sheets in <head> content part and footer part renders well but my header portion of the body encounter certain design problems as many of the properties in other css files get overridden by its grid system.
All I want to know is, is there any hack I may be able to use the
bootstrap.css for the content part?
I have also tried linking the bootstrap file in <body> below the <header> and above the content portion(I know its not a good practice.) . but it also causes the similar problems for the header portion.
What you can do is make and download a custom bootstrap version from http://getbootstrap.com/customize/ that contains only the grid system and use that CSS in your web app.
No, you can't. You're going to either have to change your markup and adjust the styles accordingly, or use an ID wrapper and change the styles in your CSS to only target <header> under that specific ID.
You're better off adjusting your styles to fit bootstrap, though.
Try adding !important to the properties that you want to customize in your CSS file.
But the best way I see to solve your issue is modifying the bootstrap.css file adding your configurations and adding !important if necessary

External CSS not working only on one page

As title suggests. I've just uploaded this to my site: http://kach.olympe.in/llsif/rare.php
The layout is very simple, the CSS as well, but it doesn't show up. And it's only on this page. The homepage and another have exactly the same code skeleton (I basically copy/pasted and changed the content), but the CSS doesn't work. If I put it internally directly, then it works. Even when I change <link href="/css.css" rel="stylesheet" type="text/css" /> to the full path, the CSS still doesn't work and I seriously can't figure out why. Is there anything I'm doing wrong?
Try to add #charset "utf-8" into the first line of your css file may help.

Question about design of css with yui drop down menu

I'm trying to incorporate this yui drop down menu control in a web page:
http://developer.yahoo.com/yui/menu/
I have it working for the most part but I discovered that one of the css files that I need to link to as part of the control mess up the formatting for the rest of my web page. This is the css file in question:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.2r1/build/reset-fonts-grids/reset-fonts-grids.css">
and this is the guilty line:
body{text-align:center;}
I'm not that experienced with css, but this doesn't seem like the friendliest design. This property is being assigned to the entire body section of the html file and could (or does in my case) impact content separate from the yahoo stuff. I know that I can fix this by putting a div tag around my stuff and setting the text-align property back to what I want it to be, but I don't feel this should be necessary. Or am I missing something here?
You do need to add a div around your body. Just redefine body style in your CSS file like
body{text-align:left;} and make sure your CSS file comes after yahoo's css file.
You can also do it inline like
<body style="text-align:left;">
This will override yahoo's body declaration for text-align.

CSS: HTML height:100% on one page only

Dumb question with a simple answer, I think.
I am building a site that has a completely different layout on one page from the rest. On one page, the design requires a liquid vertical layout, so I need the following code: *{height:100%;}On the other pages I just want the default height.
I tried to add a class to the html tag, which works in the html, but not in the CSS file. I tried:
*.myClass
and
html.myClass
but it doesn't seem to work.
I can't seem to find any info on this online. Is it even possible to add classes to the html tag?
I am using wordpress, so I can easily check to see which page I'm on and add myClass.
I guess I could also use #import to get a different style sheet based on the page I'm on, but that seems like a longwinded way of doing things.
How can I specify height:100% as a value of the html tag on specific pages only?
Can anyone point me in the right direction?
Thanks,
J
Perhaps .myClass, .myClass body {height: 100%}?
It is indeed possible to add a class to the <html> tag.
Live Demo (see code)
This will work, because I just applied this in one of my projects earlier today. :)
html,body {
height:100%
}
If you have pages that require the default height, then don't load this css style. You can place it in a separate CSS file.

Can i use an html page as content of another HTML page..?

Im new to programming..Can anybody help me out please ....
im using an html to display an image later i want to display another html on the first html so i need to set second html as transparent. so the image in the first html looks like a background image....
is it possible...?
Thanks
Well you actually could use an <iframe> containing the second page in a floating <div>-element. But as always, it's not always good just because it exists or because it was technically possible.
Except for the use of frame, you should never have more than one <html> and never more than one <body>
It would be the best to have something like this:
<html>
<head><!-- header goes here --></head>
<body style="background-image: url('first.png');">
<img src="second.png"/>
</body>
</html>
Sure you could extract the css-part into a css-file. And you could set the style-attribute for another tag as well, it doesn't forcibly has to be <body>
hope that helps a bit.
You can't. But if you just want a background image, you can accomplish this by using CSS and the background-image. See: http://www.w3schools.com/css/css_background.asp
With a scripting/programming language you can.
In ASP.NET you can read the contents of an html file and put it inside your current page.
It doesn't sound like iframe is what you are looking for. Perhaps the use of the words "on" and "transparent" are throwing me off. It sounds like you want to have two HTML pages, with the content from one appearing in front of the other but transparent? In that case I think CSS z-index might help you:
https://developer.mozilla.org/en/Understanding_CSS_z-index/Stacking_context_example_1