+ 2

I'm learner need help ,all of you .Why space is given to write a new code like CSS 4 body { font weight=20px

I can't understand why put space.. https://code.sololearn.com/W3Z4zPsGTBiY/?ref=app https://code.sololearn.com/W0AoiTgB379C/?ref=app

31st Oct 2020, 1:07 AM
SAWERA AKRAM
SAWERA AKRAM - avatar
6 Respostas
+ 3
Yes, you could write CSS as a single line. It would be less readable like Ipang mentioned, though. I'll replace a few things from your example to limit confusion and make it workable CSS. I'll replace your #color with #some-id to clarify that some-id is an id value and not a CSS property. I'll also replace your name with p to clarify that it represents a tag name. Also, I'll replace your ; with : because ; isn't valid immediately after a property name. #some-id p { color: blue; } That can be rewritten in one line as: #some-id p { color: blue; } This also will work: #some-id p{color:blue;} Removing the space between #some-id and p would change meaning, though. In other words, the following will match an element with id="some-idp" where the selector above would select p elements that are contained in a id="some-id" element: #some-idp{color:blue;}
31st Oct 2020, 8:33 AM
Josh Greig
Josh Greig - avatar
+ 3
Where are you seeing this space? I checked both links and couldn't get a clear sense of what you want to ask about. Here are the CSS body properties I see in https://code.sololearn.com/W3Z4zPsGTBiY/?ref=app#css: body { margin:0; padding:0; background:black; user-select:none; overflow:hidden; -webkit-user-select : none; } Your question refers to font-weight but I don't see it there. It would help if you copy/paste the related code here because the referenced code can be updated any time and you have no control over it.
31st Oct 2020, 2:46 AM
Josh Greig
Josh Greig - avatar
+ 3
Thanks both of you
31st Oct 2020, 4:44 AM
SAWERA AKRAM
SAWERA AKRAM - avatar
+ 2
SAWERA AKRAM If you were asking of why there are spaces before a property name, then rest assured that it was meant for a good reason, which is code readability. As Josh Greig said, avoid linking irrelevant stuffs (e.g. other people's codes/threads). You should rather link your own code, so please edit the thread Description accordingly 👍
31st Oct 2020, 3:01 AM
Ipang
+ 2
Sawera, what was the space you were asking about? I'm still curious even if you figured it out.
31st Oct 2020, 7:11 AM
Josh Greig
Josh Greig - avatar
+ 2
Why space is given in curly braces ? why we didn't write in a single line ? Why we write color... Name in a separate line ? (in CSS). <Style="text/css" > #color name { Color; blue; }. Can I write this as #color name {color:blue;} if write then why we follow above right pattern?
31st Oct 2020, 8:01 AM
SAWERA AKRAM
SAWERA AKRAM - avatar