Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

css, html

Posted on 2016-10-25
6
Medium Priority
?
89 Views
Last Modified: 2016-11-15
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

0
Comment
Question by:ITsolutionWizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 20

Accepted Solution

by:
Russ Suter earned 2000 total points
ID: 41858959
You need to apply the style to the <p> elements inside the div. Add this to your CSS:
        div:hover p {
          color: black;
        }

Open in new window

Or if you want to apply the color to all elements (regardless of type)...
        div:hover * {
          color: black;
        }

Open in new window

0
 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 41858964
it does not work
0
 
LVL 20

Expert Comment

by:Russ Suter
ID: 41859017
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 41859020
I need to use inline css
0
 
LVL 20

Expert Comment

by:Russ Suter
ID: 41859026
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.
0
 
LVL 20

Expert Comment

by:Russ Suter
ID: 41859039
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.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question