Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Web Coding

Reply
 
LinkBack Thread Tools
Old 06-05-08   #1 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,478

FAQs Submitted: 7
Folding Team Rank: 396
Trader Rating: 0
Default CSS help

Well I'm new to web coding and have a lot to learn. I need some help though with using CSS and setting the color of links.

I have the following stylesheet:

Code:
.magazine_cover {
    position: relative;
    margin: 0px; padding: 0px; 
     width:477px;
    _width:477px;
    height:556px;
    float:left;
    border-left:#000;
    padding-left: 15px;
    color: black;
}
.magazine_cover .title {
    position: absolute;
    top: 20px; left: 0px;
    width: 492px; text-align: center; 
    line-height: 30px;
    height: 30px;
    font-size: 30px; font-weight; bold; color: #fff;
}
.magazine_cover .link {
    position: absolute;
    width: 120px; 
    line-height: 20px;
    height:30px;
    font-size: 16px;
}
And in my .html file,

<div class="link" style="a:link {color:green}; a:visited {color:green};"> <a href="#">..</a></div>

Is that the proper way to set the color for a link? Is there an easy way to put that in a new class like:

Code:
.magazine .link .green {
....
....
}
Thanks!
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 06-05-08   #2 (permalink)
PC Gamer
 
Boris4ka's Avatar
 
intel nvidia

Join Date: Mar 2006
Location: San Francisco, CA
Posts: 2,875
Blog Entries: 2

Rep: 196 Boris4ka is acknowledged by manyBoris4ka is acknowledged by many
Unique Rep: 158
Folding Team Rank: 690
Trader Rating: 17
Default

You're doing it wrong.

For the HTML, it would be:

Code:
<div class="magazine_cover">
<a href="http://www.google.com">Google</a>
</div>
And the CSS for that would be:

Code:
.magazine_cover{
*put your parameters for the whole div here*
}

.magazine_cover a{
*put styling for links here*
}

.magazine_cover a:hover{
*put styling for hover on links here*
}

.magazine_cover a:visited{
*put styling for visited links here*
}

System: über pwnage
CPU
E6600 3.0GHz 1.4v
Motherboard
Gigabyte GA-P35-S3L
Memory
2x2GB G.Skill 6400 835MHz
Graphics Card
EVGA 8800GTS 320MB
Hard Drive
320GB .10 + 80GB .7
Sound Card
Onboard HD Audio
Power Supply
Rosewill Performance 550W
Case
Centurion 5 w/ side window
CPU cooling
Golden Orb 2 - lapped
GPU cooling
Stock fan
OS
Vista Ultimate x64
Monitor
X191W 19"w + Sony 15" LCDs
Boris4ka is offline I fold for Overclock.net Boris4ka's Gallery   Reply With Quote
Old 06-05-08   #3 (permalink)
(>'.')> vs <('.'<)
 
pow3rtr1p's Avatar
 
intel ati

Join Date: Jun 2006
Location: The Keywork
Posts: 5,966
Blog Entries: 3

Rep: 416 pow3rtr1p is a proven memberpow3rtr1p is a proven memberpow3rtr1p is a proven memberpow3rtr1p is a proven memberpow3rtr1p is a proven member
Unique Rep: 308
FAQs Submitted: 3
Folding Team Rank: 508
Trader Rating: 11
Default

I thought Hobo started playing games. Guess not, lol.
__________________

System: Soberclock.net
CPU
E8400
Motherboard
DFI LP Dark P35
Memory
2x2GB G Skill 800 MHz @ 4-4-4-12
Graphics Card
Sapphire x1950XTX
Hard Drive
640GB Western Digital Caviar Black
Sound Card
Onboard (Very Sad)
Power Supply
Silverstone DA750 (60A 12V)
Case
Cooler Master Stacker 832
CPU cooling
Xigmatek HDT-S1283 w/ Yate Loon @ 40C Load
GPU cooling
UV Red Stock w/ AS5 @ 52C Load
OS
Vista Home Premium 64-Bit
Monitor
Samsung 204-B 1600 x 1200
pow3rtr1p is offline I fold for Overclock.net Overclocked Account pow3rtr1p's Gallery   Reply With Quote
Old 06-05-08   #4 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,478

FAQs Submitted: 7
Folding Team Rank: 396
Trader Rating: 0
Default

Well the stylesheet was given to me by my boss.

The problem is though I can't hard code the color in the stylesheet b/c its a RoR app.

So really in my code the div looks:

<div class="link" style="<%= next_cover_link_pos(count) %> a:link {color:<%= cover.link_color %>;}" >
<%= "<a href=\""+link.url+"\">"+link.title+"</a>" %>
</div>
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 06-05-08   #5 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,478

FAQs Submitted: 7
Folding Team Rank: 396
Trader Rating: 0
Default

Well I got what I needed. For anyone interested:
Little ugly if you don't know Ruby on Rails.

At the top of my page I load a stylesheet that lets me set the color according to the cover object.

Code:
<% content_for 'stylesheet' do %>
<style>
    a.link_color:link {color:<%= @cover.link_color %>;}
    a.link_color:visited {color: <%= @cover.link_color %>;}
    a.link_color:hover {color:blue;}
</style>
<% end %>
and then the div is simply:

Code:
<div class="link" style="<%= next_cover_link_pos(count) %>" >
   <%= "<a class=\"link_color\" href=\""+link.url+"\">"+link.title+"</a>" %>
 </div>
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 09:25 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.21777 seconds with 8 queries