+ 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
6 Answers
+ 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;}
+ 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.
+ 3
Thanks both of you
+ 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 đ
+ 2
Sawera, what was the space you were asking about? I'm still curious even if you figured it out.
+ 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?