Solved

css, html

Posted on 2016-10-25
6
70 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 500 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Two decimal 5 43
Can anyone help me find this preloader? 51 67
boostsrap 1 34
carousel control extend past the images 9 26
This article discusses four methods for overlaying images in a container on a web page
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

734 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