Solved

CSS Style

Posted on 2014-11-19
4
151 Views
Last Modified: 2014-11-20
Why some css attribute need # while some don't ? Any special meaning for "." in css ?


<style type='text/css'>
       <!--
       legend {
         font-weight: bold;
         font-size: 1.2em;
         margin-bottom: .5em;
         }
       #wrapper {
         margin: 0;
         padding: 0;
         }
       #field {padding-bottom: .5em;}
       .errors {
         font-weight: bold;
         font-style: italic;
         font-size: 90%;
         color: red;
         margin-top: 0;
         }
        -->
     </style>
0
Comment
Question by:AXISHK
  • 2
4 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 150 total points
ID: 40454379
'#' is for 'id', '.' is for 'class'.  'id's are supposed to be unique on a page because they are also used by javascript.  'class' is a general style that can be applied to many elements.  Tutorial here: http://www.w3schools.com/css/default.asp
0
 

Author Comment

by:AXISHK
ID: 40455078
"ul li"   and "ul li.level2" - what does it mean ? Tks
 
      ul li {
         list-style: none;
         font-weight: bold;
         padding-top: .5em;
         font-size: 1.2em;
         }
       ul li.level2 {
         margin-left: -1em;
         font-weight: normal;
         font-size: .9em;
         }
0
 
LVL 9

Accepted Solution

by:
WebDevEM earned 350 total points
ID: 40455250
"ul li" would apply to any "li" within any "ul" regardless of ID or CLASS assigned to them.  Getting more specific, "ul li.level2" would apply to any "li" within a "ul" only if that "li" has a class of "level2".  Remember that these will add to each other, not replace each other.

Like so:
<ul>
 <li>This gets the style from "ul li" only</li>
 <li class="level2">This gets the style from both, because it is an li AND it is an li.level2.  Because there is overlap in the styles, this li will have list-style: none, font-weight: normal, padding-top:.5em, margin-left:-1em and font-size: .9em</li>
</ul>
0
 

Author Closing Comment

by:AXISHK
ID: 40456506
Tks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

831 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