CppBuzz.com
  
Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test Forum

Home » Forum » x-Forum » Question

HTML and CSS

I have a problem, there is still margin in left and top...
i want to clear them by my img, here is the code..

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link rel="stylesheet" type="text/css" href="second.css">
	</head>
	
<body>
	<header>	
	<div  class= "header">
		<img  src="yourname.jpg"  > 

	</div>
</header>

</body>
</html>






This is for css


#header >  {
padding-top:0px;
padding-left: 0px;

}

Posted by Ravelo 2018-09-10 18:47:12

Hi Ravelo, 

Put this in ur css file.

html, body {
    margin:0;
    padding:0;
    color: #242729;
}

And there is error in ur css code. Why there is > symbol? and since header is class then there shold be dot(.) not $. Correct one is 

.header {
padding-top: 0px;
padding-left: 0px;
}

C++ user image Admin answered 2018-09-10 18:58:20

Great it worked...
Thanks for solution...

C++ user image Ravelo answered 2018-09-10 19:13:13

Hi Ravelo,
             
        I just want to discuss one thing .You have used "#" in the CSS code right.Please find the following two statements to have a clear idea where to use.

1.Actually "#" is used when you mention the header as an id. 

example:

     html code:

       <h1 id="header"> </h1>

     css code:
     
       #header{
                     .......
                    }


2.If you have mention the name header as class you have to use only "."


example:


  html code:

       <h1 class="header"> </h1>

     css code:
     
       .header{
                     .......
                    }



Thank you.

C++ user image Gowthami answered 2018-09-10 23:50:54

You can solve that issue using 

html{

      margin : 0;
      padding: 0;
  
}  

//This will absolutely work...

C++ user image kwedbh answered 2018-09-19 15:47:43

Your Answer


Ask New Question