Solved

css, html

Posted on 2016-10-25
6
29 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
  • 4
  • 2
6 Comments
 
LVL 20

Accepted Solution

by:
Russ Suter earned 500 total points
Comment Utility
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
 

Author Comment

by:ITsolutionWizard
Comment Utility
it does not work
0
 
LVL 20

Expert Comment

by:Russ Suter
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:ITsolutionWizard
Comment Utility
I need to use inline css
0
 
LVL 20

Expert Comment

by:Russ Suter
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now