Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

css, html

A few questions below:

1. When div is mouseover, i want to change the font color to black. Now is not working.
2. I use  <span style="font-family:'Arial Rounded MT';font-weight:bolder;font-size:23px;">Stanton, CA</span> but it is still not round and bold enough. How can make it more round and bolder?

3. I try to put all style inline. but somehow it is not working. Can you help me?

4. I have div inside of style. I would like to have little control. like StantonDiv and ChinoDiv can have the style only.
It is just because I have other <div> inside of the same page and I do not want them to use the style.


Thanks,



  <style>
        div
        {
            border:2px solid;border-color:darkred;background-color:darkred;
           
        }      
        div:hover
        {
            background-color:yellow;     
            color:black;                         
        }
    </style> 
                    <div style="height:80px;width:300px;text-align:center;" id="StantonDiv">
                          <a style="text-decoration: none;color:white;" href="#"> 
                                <p>                                     
                                    <span style="font-family:'Arial Rounded MT';font-weight:bolder;font-size:23px;">Stanton, CA</span>
                                     <br />
                                    <span style="font-family:'Brush Script MT';font-size:20px;">Orange & Los Angeles Area</span>                                    
                                </p>
                         </a>
                    </div>
                    <div style="height:80px;width:300px;text-align:center;" id="ChinoDiv">
                          <a style="text-decoration: none;color:white;" href="#"> 
                                <p>                                     
                                    <label style="font-family:'Arial Rounded MT';font-weight:bolder;font-size:23px;">Chino, CA</label>
                                     <br />
                                    <label style="font-family:'Brush Script MT';font-size:20px;">Inland Empire Area</label>                                    
                                </p>
                         </a>
                    </div>                   

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Russ Suter
Russ Suter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITsolutionWizard

ASKER

it does not work
Avatar of Russ Suter
Russ Suter

It does. Here's proof:
https://jsfiddle.net/1roz2v19/

Although I realize I only answered your first question. Inline styles are generally frowned upon and should not be used in most cases. You should put all your style markup in CSS and use class declarations whenever possible.
I need to use inline css
Why? There's almost never a good reason. You will create problems for yourself in the 4th question if you do. You cannot control inline styles with CSS. Inline styles ALWAYS override CSS unless your CSS markup uses the !important directive and your inline style does not.

You can accomplish exactly the same result using classes. Give me 5 minutes to work up an example.
OK, here is the exact same layout using only CSS.
https://jsfiddle.net/1roz2v19/1/

Advantages:
- The page load is faster because browsers can cache CSS and reuse styles rather than declaring the same style repeatedly.
- Your markup is much easier to maintain because you can change a single style and it will automatically update the entire website.
- Styles can be easily applied, overridden, and manipulated.