I'm making a web page (lots of them that are connected)
I have added the glow function/attribute to my buttons in CSS. The thing is I've used this;
button:hover {
border: 80px solid #ffffff;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
-webkit-box-shadow: 0px 0px 4px #ffffff;
-moz-box-shadow: 0px 0px 4px #ffffff;
box-shadow: 0px 0px 4px #ffffff;
}
The thing is, my CSS file is linked and being used by 5 different HTML files and more are coming. So instead of just getting the glow effect on just 4-5 buttons that I have on one HTML page, the glow function now is on all buttons on all other HTML pages.
How do I avoid this, I cant add the glow function inside the #id's can I?
My buttons like like this in css
#TrafficJam1 {
position: absolute;
top: 1120px;
left: 20px;
height:107px;
width: 278px;
}
That's just one of them
Here's the HTML part of that particular one,
<input type="image" src="TrafficJam.jpg" id="TrafficJam1">
I have to use this code because my buttons are images.
Give the buttons you want to apply this CSS to a class like this:
<input type="image" src="TrafficJam.jpg" id="TrafficJam1" class="glow">
A class is another identifier for html elements. But it's different from id in the sense that you may use them to target multiple elements at a time. So you can just give the buttons you want this effect on the same class and target that class in your CSS like this:
.glow:hover {
border: 80px solid #ffffff;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
-webkit-box-shadow: 0px 0px 4px #ffffff;
-moz-box-shadow: 0px 0px 4px #ffffff;
box-shadow: 0px 0px 4px #ffffff;
}
Then a little bit off topic. The thing you're asking is pretty basic stuff. So I get it that you're beginner at HTML and CSS, right? In case you are it would be wise to learn some more HTML and CSS with an online learning tool like codecademy.com.
Create a new stylesheet and link this in the page where you want the buttons to glow.
This is easily done by using the <link> tag, but I guess you are familiar with that.
In that file you could just add the code you were using:
.classname:hover {
border: 80px solid #ffffff;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
-webkit-box-shadow: 0px 0px 4px #ffffff;
-moz-box-shadow: 0px 0px 4px #ffffff;
box-shadow: 0px 0px 4px #ffffff;
}
Related
I am trying to work out how I get a navigation menu next to my blog content.
I don't want the navigation menu header - the button that makes the menu slide out. I want the menu to show inside a card.
Here is what I have so far, but it is not material:
HTML
<ul class="card_nav">
<li> <a>test</a></li>
</ul>
CSS
.card_nav {
list-style: none;
width: auto;
height: auto;
margin: 8px auto;
border-radius: 0;
background-color: #FFF;
/*box-shadow: 0px 20px 70px 0px rgba(0, 0, 0, 0.21);*/
position: relative;
overflow: hidden;
}
For show the rules of material design you can see here
Create a visual language that synthesizes classic principles of good design with the innovation and possibility of technology and science.
For this you can use text, border or other way that must choose you.
Develop a single underlying system that allows for a unified experience across platforms and device sizes. Mobile precepts are fundamental, but touch, voice, mouse, and keyboard are all first-class input methods.
For you can use media queries, flexbox, semantic tag like `, , ` etc. and also `attr abbr` for screen reader.
So, I advice you of use shadow for your box, border-radius and other effects similar.
I've tried to do an easy code in material style based on your code:
.card_nav {
list-style: none;
width: 100px;
height: 400px;
margin: 8px auto;
border-radius: 0;
background-color: #FFF;
/*box-shadow: 0px 20px 70px 0px rgba(0, 0, 0, 0.21);*/
position: relative;
overflow: hidden;
-webkit-box-shadow: 1px 1px 3px 2px #eee;
-moz-box-shadow:1px 1px 3px 2px #eee ;
box-shadow: 1px 1px 3px 2px #eee;
padding: 10px 20px;
}
ul.card_nav li a {
text-transform: uppercase;
text-align: center;
}
ul.card_nav li a:hover {
border-bottom: 2px solid #ff0000;
}
<ul class="card_nav">
<li> <a>test</a></li>
</ul>
I have a bootstrap button over which I want to have a bubble with a number, much like a notification that appears on an app icon in an iphone.
My mark up for the button is:
<button class="btn btn-warning view-sl-btn" type="button"><span class="notification, red">6</span>View Shortlist</button>
And the Css for the span is:
.btn.span {
position: absolute;
background-color: #f56c7e;
border: 1px solid #ce4f5e;
padding: 2px 5px 1px;
margin-left: -2px;
margin-top: -16px;
border-radius: 100px;
color: #fff;
text-shadow: 0px 1px 0px rgba(0,0,0,0.2);
font-size: 11px;
-webkit-box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
-moz-box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
-o-box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
box-shadow: inset 0px 1px 2px rgba(255,255,255,0.4);
}
.btn.span.red {
background-color: #f56c7e;
border-color: #ce4f5e;
}
But it doesn't seem to work.
Any advice will be much appreciated.
Cheers
The issue is with your CSS declaration:
.btn.span
(Would apply styles to all elements with the 'btn' class AND the 'span' class.)
<div class="btn span" />
You want this:
.btn span
(Which would style all spans that are descendants of an element with the 'btn' class.)
Use the following instead
.btn span
Yes, .btn span is the proper syntax for the css since span is an HTML tag. The use of the period before the span would suggest it is a css class, which it is not.
I have a navigation bar but want to add images to it, so that rather than text links, the nav bar is made up of buttons consisting of an image and text which have a hover effect etc.
But as some of the link names are dynamic I can't make the buttons in photoshop so was wondering how to make this type of nav bar in just html and css.
Any ideas?
EDIT
To clarify i have the following image sample nav button
and want to add text beneath this to form the buttons on the nav bar if that makes it clearer.
You can do a lot just with CSS
The basic idea is to change attributes of each state of the button using pseudo classes .cssclass:hover to mouse over state and .cssclass:active to mouse down.
normal
/* style of the button in normal state */
button.css3button{
padding: 0.5em;
background-color: lightblue;
border: 4px outset green;
color: green;
border-radius: 4px;
}
:hover
/* properties that change when mouse over */
button.css3button:hover {
background-color: lightgreen;
}
:active
/* properties that change when mouse down */
button.css3button:active {
color: yellow;
border: 4px inset red;
}
Live Demo: JSFIDDLE
more complex styling examples with CSS3:
<button type="button" name="" value="" class="css3button">submit</button>
button.css3button {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #ffffff;
padding: 10px 20px;
background: -moz-linear-gradient(
top,
#bfc2ff 0%,
#82b4ff 25%,
#4664fa);
background: -webkit-gradient(
linear, left top, left bottom,
from(#bfc2ff),
color-stop(0.25, #82b4ff),
to(#4664fa));
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
border-radius: 30px;
border: 3px solid #ffffff;
-moz-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 1px rgba(49,141,212,1);
-webkit-box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 1px rgba(49,141,212,1);
box-shadow:
0px 3px 11px rgba(000,000,000,0.5),
inset 0px 0px 1px rgba(49,141,212,1);
text-shadow:
0px -1px 0px rgba(000,000,000,0.2),
0px 1px 0px rgba(255,255,255,0.3);
}
Demo: JSFIDDLE
you can of course change sizes, colors, gradients for each state :hover :active :visited on your own taste, you can style almost anything <a> <span> <div> <button>
This question isn't really suited for this forum. It is for specific problems, not basic tutorials. There are plenty of good tutorials out there you can find by doing a simple google search that walk you through basic CSS and how to achieve this.
But just to get you started, you could do something like this: http://jsfiddle.net/wgBTZ/
HTML:
<ul>
<li><a href="#" >One</a></li>
<li><a href="#" >Two</a></li>
<li><a href="#" >Three</a></li>
<li><a href="#" >Four</a></li>
</ul>
CSS:
li {
float:left;
width: 100px;
height: 40px;
background:#CCC;
margin:0 0 0 15px;
}
a {
color: black;
text-decoration:none;
float:left;
width: 100px;
height: 40px;
background:#CCC;
}
a:hover {
background:#000;
color:white
}
Edit: This is just the basic mechanics. With CSS3 you can take what I've done above and actually build some pretty cool stuff.
I am trying to do some CSS to complement my HTML code. I am effectively trying to make a little box which changes size based on the amount of text there is. Currently, this is what it looks like in action.
Essentially, I'd like it to form a little box around the text. Notice the last 'box' in the image, if the string is too long, it cuts it off and continues on the next line.
Included is the CSS code and an example of usage.
<style type="text/css">
boxytest
{
padding: 10px;
text-align: center;
line-height: 400%%;
background-color: #fff;
border: 5px solid #666;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 2px 2px 4px #888;
-moz-box-shadow: 2px 2px 4px #888;
box-shadow: 2px 2px 4px #888;
}
</style>
<body>
<div align="center">
<boxytest> Hey guys! What's up? </boxytest>
</div>
</body>
Any help is greatly appreciated.
As chipcullen says inventing your own element is probably not the best way to go about this. But to answer your question the key style decleration your missing appears to be display:inline-block;
jsfiddle here
Well, I think first off, in terms of markup, you want to make boxytest a class, and not create a new element. And don't use 'align=center'. It's a pain to maintain.
I would do something like this:
<body>
<p class="boxy">Test sentence</p>
<body>
The in CSS:
.boxy {
padding: 10px;
text-align: center;
line-height: 400%%;
background-color: #fff;
border: 5px solid #666;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 2px 2px 4px #888;
-moz-box-shadow: 2px 2px 4px #888;
box-shadow: 2px 2px 4px #888;
/* to prevent word wrapping */
white-space: nowrap;
overflow: hidden;
}
The last bit is based on this post.
I want to use CSS to create rounded-corners on facebook fan-page. I have created the fanpage but I can't get the styles to work for safari browser. I have used to Safari Development tools and when I do the in-line styles it actually works but when I go and put it in the fbml code, nothing updates in safari. I have also included the same style in a stylesheet which is hosted somewhere else and it doesn't work. any help would be appreciated.
My CSS for rounded-corners
-webkit-border-radius: 0px 0px 8px 8px;
-moz-border-radius: 0px 0px 8px 8px;
-khtml-border-radius: 0px 0px 8px 8px;
-webkit-box-shadow: #666 0px 2px 3px;
border-radius: 0px 0px 8px 8px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
padding-left: 5px;
padding-right: 5px;
background: #DAE1EB;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#DAE1EB), to(#DAE1EB));
background: -moz-linear-gradient(#DAE1EB, #DAE1EB);
background: linear-gradient(#DAE1EB, #DAE1EB);
-pie-background: linear-gradient(#DAE1EB, #DAE1EB);
I don't see why it shouldn't work.
Try this:
In the src of your CSS after is says .css try putting .css?2 (any number).
I've had some problems with FB caching and it's CDN, this usually solves it.
Let me know if this helps.