Aug 12

Block and Inline Usage

When working with an HTML document that will be posted on the web, it is important to bring your attention on how you lay your HTML tags and how it its being used. For example, in your website, you post your web site name which is WEB STANDARD WEBSITE. So we have to use <H1> WEB STANDARD WEBSITE </H1>.

The old traditional way of marking up, we tend to use TABLE in laying out the structure of our webpage. Now they introduce DIV. Div is a markup for grouping and sorting website components that groups each website portion and function. Div is a block-level whereas a span is an inline element which can be seen and present in Adobe Dreamweaver.

Here is how it looks like in Dreamweaver:

Block and Inline element Display on Dreamweaver

Block and Inline element Display on Dreamweaver

Visually it looks like a whole block that group content.

So this is where CSS comes in to rescue, when you want your HTML tag to have a block element. #id { display : block; }

Tagged with:
Nov 27

Newbie Web Developers Common Mistakes

Last week our company had a skill test exam for front-end web developer vacancy. I sneak peek a couple designs and I found out some bad habits in their codes.

Here are the coding habits you would like to avoid.

Use the right tag for appropriate function.

vertical category list

vertical category list

Here is a bad vertical category list source code.
Example 1

Comment: overkill div tags

<div> Shop by Categories</div>

<div class=”business”>Business and Management</div>

<div class=”business”>Business and Management</div>

<div class=”business”>Business and Management</div>

<div class=”business”>Business and Management</div>

Example 2

Comment: dont use heading tags on your category list

<div class=”business_management”>

<a href=”#”><h2>Business and Management</h2></a>

</div>

<div class=”business_management”>

<a href=”#”><h2>Business and Management</h2></a>

</div>

<div class=”business_management”>

<a href=”#”><h2>Business and Management</h2></a>

</div>

Example 3

Comment: update your web development skills

<div class=”shopbycategories”><font class=”shopbycategoriesText”>Shop by Categories </font></div>

<div class=”greenleftBG”><font class=”businessmgtTEXT”>Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

Business and Management<br>

</font><br>

Here is the correct way presenting your source code for vertical category list

Comment: your id=”category” will now take care of the styling

<div id=”category”>

<h2> Shop by Categories </h2>

<ul>

<li><a href=”#”> Business and Management</a></li>

<li><a href=”#”> Business and Management</a></li>

<li><a href=”#”> Business and Management</a></li>

</ul>

</div>

Remember you are coding for a vertical category “list” so you might as well use list tag and make use of li tags.

Tagged with:
Nov 19

Optimized Css Text Gradient

Front-end web developers always want to find ways to optimize your HTML and CSS code. I saw a post on Cssglobe.com by Alen Grakalic about CSS Text Gradient and it opened me the idea about CSS Text Gradient. So maybe I can have this look gradient without using a transparent gradient PNG file. Bestwebbuzz.com presents text gradient without transparent gradient PNG file. This is how it works.

css gradient

css gradient

CSS
h2 {
 font-size:250%;
 color:#0079b6;
 font-weight:normal;
 letter-spacing:-.05em;
 margin:.6em 0;
 position:relative; 
 font-weight:bold;
}
h2 span{
 position:absolute;
 display:block;
 top:0;
 left:0;
 height:60%;
 width:100%;
 background-color:#FFFFFF;
 filter: alpha(opacity=65); /*     <—-this part do the magic——*/
  -moz-opacity: 0.65;/*       <—–this part do the magic———*/
  opacity: 0.65;/*          <—-this part do the magic———-*/
}

HTML
<h2>My Cool Title<span></span></h2>
<h3>My Cool Title<span></span></h3>

You can download the demo file here demo

I would like to thank Alen of cssglobe and Virgil of jampmark.com for the idea and concept.

Tagged with:
Oct 22

Highlighting different link types part 2

Highlighting Downloadable documents and feeds

Another common frustration is clicking on a link thinking it is going to take you to a page only for it to start downloading a PDF or Microsoft Word document. Luckily, CSS can help us distinguish these types of links as well. This is done using the [att$= val] attribute selector, which targets attributes that end in a particular value, such as pdf or .doc:

Example:

a[href=".pdf"] {
background:url(images/pdflink.gif) no-repeat right top;
padding-right: 10px;
}
a[href=".doc"] {
background:url(images/wordlink.gif) no-repeat right top;
padding-right: 10px;
}

So in a similar way to the previous examples, you can highlight links to word documents or PDFs with their own separate icon, warning people that they are downloads rather than links to another page

Lastly, many people have RSS feeds on their website well specially blogs like WordPress. The idea is for people to copy these links into their feed readers. However, inadvertently clicking one of these links may take you to a page of seemingly meaningless data to avoid possible confusion. You could highlight RSS icon:
a[href=".rss"] {
background:url(images/rsslink.gif) no-repeat right top;
padding-right: 10px;
}

Tagged with:
Oct 16

Highlighting different link types part 1

Highlighting different types of link

Some of you might already know this technique but for people still learning CSS this might help you.

A link from your website to an external page can be highlighted without using a class or an id for each anchor.

To identify if your link an external link using [href^="http:"]
#container p a[href^="http:"] {
  background: url(images/externalLink.gif) no-repeat right top;
  padding-right: 10px;
}

#container p a[href^="http://www.bestwebbuzz.com"], a[href^="http:// bestwebbuzz.com"]  {
  background-image: none;
  padding-right: 0;
}

<div id=”container”>
<p><a href=”http://www.google.com/”>This is an external link</a></p>

this is how it would look like

External Link Screen Shot
External Link Screen Shot

 

Links mixed with internal and external links
<p>And here is a reasonably long line of text containing  an <a href=”http://www. bestwebbuzz.com/index.php”>absolute internal link</a>, some text, an <a href=”http://www.yahoo.com/”>an external link</a>, some more text, a <a href=”css-button.htm”>relative internal link</a> and then some more text.</p>
</div>

this is how it would look like

mixed with internal and external links

mixed with internal and external links

 

You can even do it with this links

mailto:

aim:

<p>Contact me by <a href=”mailto:info@andybudd.com”>email</a><br />
Send me an <a href=”aim:goim?screenname=andybudd”>instant message</a> using AIM/iChat.</p>

This is how it would look like

highlighting im and email links
highlighting im and email links

Unfortunately this does work on IE6 but work on modern browsers.

You can download source here external_link

 

This post will be continueed on the next post so watch out for that.

Tagged with:
preload preload preload