+ 4
Best coding practice for html / css?
Hi guys, I was coding my html / css code here and realized that i was writing the same redundant lines of code again and again for my repeating elements. Eg: the lamp post in my code below occurs 20 times so i had to code that element 20 times. Which i some how find very unconvincing.. Is there a way in which we can eliminate this redundant coding for repeating elements? like a loop or something? Is it possible? https://code.sololearn.com/Wsj2Na2Iq22x/?ref=app
17 Respostas
+ 8
@Shraddha I have to get up at 5:45. đȘ
+ 7
Hahaha needs patience... a lot of it đ. Especially if u like to sleep and code đđ
+ 6
Thanks @Geoffrey âșïž
I am learning parallax.. This is all i can do on my phone lol. I'll try to improve it overtime. Animate on scroll type effect n add a few birds or cars
+ 6
FYI its 3:31 am here đ
Fireworks... That'll be cool... Thanks for suggesting âșïž
+ 6
@Geoffrey added fireworks and now it is more lovely đ
Thanks for suggesting âșïž
Its much better than the cars n birds i was thinking lol
+ 6
Woah!! What an idea đ.. But its gonna take time.. I've not worked with mouse positions đ
+ 5
I am aware that we can add inner html using php/js loops, but was just hoping that it should be there in html too, may b i am wrong đ
+ 5
Will have a look at it
+ 4
You can use PHP or Javascript to generate repeating parts of page code. Not sure if you can do same thing with HTML only.
+ 4
@Shraddha That could be the game! press on the sky to throw a firework to shoot the bird which fall on cars and cars explode on contact with the dead bird @_@
+ 3
Nice moon! đ đ± With an interactive parallax effect it would be more amazing I think.
+ 3
Great! If I tried to code more that 10 lines on my phone I would change everyday for a new phone xD keep throw them away!... or put them under each others to build a multi mobile screens... hmmmmMmmmm *thinking*
+ 3
You are right! Patience is part of coding :3 that's why I'm about to sleep, I'm not patient xD
Well no, o.k the true reason is that's midnight here and I wake up at 6:30 a.m (+45 min of try to open first eye), so time to go! See ya! code well and I except a firework behind the moon at first hour tomorrow morning after I open my second eye (about 10:00 am)
+ 3
Yeah!!!!! đđđđđđđ
+ 2
đ from the poetic to the no idea trash mash up of ideas.
Work with mouse position is not that hard =)
The main idea is the mouse event function return an object including x and y coordinates of the cursor.
With jQuery it looks like something:
myTarget.on("mousemove", function(eventDatas)
{
posX = eventDatas.x;
posY = eventDatas.y;
}
)
I haven't the doc with me be the global idea is this.