Archive

Posts Tagged ‘CSS’

Comments in CSS and HTML

January 27th, 2012 No comments

GUEST BLOGGER: Cristian Easterly, Applications Instructor

When working with any kind of code, you may come to a point where you need to label certain lines. You may want to stop and come back to work on the code another time and leave yourself a note so you don’t have to read through each line to make sure it is correct. You may also want to write yourself notes if you are a beginner and need to refer back to that text document to know what each line of code means/does. Another reason for adding comments would be if you were sharing your code with someone else. They need to know why you wrote the code that you did and what it is actually doing.  I am going to show you how to write a comment in CSS and HTML. They are slightly different but will do the same thing. It will allow you to write anything you want in your text document without affecting the code itself.

HTML:

 <a href=”index.html”>Home</a>

<!– Link to Home page –>

<a href=”contact.html”>Contact</a>

<!– Link to Contact page –>

The red text shows the comments in HTML. It starts with “<!–“ and ends with “–>”. You can write anything you want between them. The purpose of comments is to write something without changing your code at all. I even like to add fun little comments if I am sharing my code with someone else because I know that whatever I write will NOT show up on the page.

CSS:

p {

            font-size: 24px;

            /* 24 is also the current font size for the content section on the home page */

}

This is what a comment will look like on your CSS style sheet. It looks a little different than a comment in HTML, but it acts the same way. You can write whatever you want without changing your code. Start with “/*” and end with “*/”. It’s as simple as that.

These comments can go anywhere in your code. Just make sure to use the correct format for the type of code you are working with. Remember that the comments will not be interpreted, so you can write in any format you want to.

View upcoming HTML classes here.

PinterestLinkedInDiggShare

Use ASP.NET’s Visible property

January 22nd, 2011 No comments

ASP.NETUse ASP.NET’s Visible property to do more than just hide the content (ASP.NET)

If you’ve explored ASP.NET’s server controls, you’ve probably run across the built-in Visible property. At first, you may wonder how it’s different from the CSS visibility setting. After all, both settings effectively make the relevant page element visible or invisible. The difference is in the rendering.

In CSS, to make an element invisible, you set the element’s visibility property to hidden. With this setting in place, the browser won’t display the related content. With ASP.NET’s Visible property, setting it to False produces the same end results. However, keep in mind that because CSS is only concerned with the client-side display, it doesn’t prevent the invisible content from actually being sent to the browser (or other user agent). A server control’s Visible property, on the other hand, dictates whether ASP.NET will even send rendered content to the browser. As a result, if you set a control’s Visible property to False, the final rendered HTML won’t contain any tags related to the server control. This behavior is critical when you need to conditionally send content to the browser—-for instance, based on the user’s authentication level. If any old script-kiddie can view a Web page’s source code to get sensitive information, hiding it from display doesn’t do you much good.

Check out our ASP.NET training!

PinterestLinkedInDiggShare
Categories: Tips & Tricks