Search code examples
htmlcsscss-position

how to position elements?


How to make this following image and paragraph tag come next to each other (image and p tag in left and right respectively) like inline block elements. I used the span tag bec its inline but i still couldnt figure it out


Solution

  • The response object is an object that contains all the methods for manipulating the outgoing response and for queuing up data that will be part of that response (when it is finally sent). The specific method you asked about:

    res.setHeader(name, value)
    

    is one such method for preparing the outgoing response and is documented here. It allows you to configure a header on that response. It will store that header inside the res object and then when the response is finally sent out over the network, this header item will be streamed as part of the outgoing http headers.

    The Express library adds a different variation of this method with:

    res.set(field, value)
    

    or

    res.header(field, value)
    

    These are both identical in the code.

    Internally, both of these just add a little bit of extra processing before eventually calling the underlying res.setHeader() from the regular http library. You can use any one of them. The Express version allows you to call res.set(obj) where obj is a set of key/value pairs that are turned into headers.

    You can see the code for Express' res.set() here and see how it eventually calls the underlying res.setHeader().

    res.set =
    res.header = function header(field, val) {
      if (arguments.length === 2) {
        var value = Array.isArray(val)
          ? val.map(String)
          : String(val);
    
        // add charset to content-type
        if (field.toLowerCase() === 'content-type') {
          if (Array.isArray(value)) {
            throw new TypeError('Content-Type cannot be set to an Array');
          }
          if (!charsetRegExp.test(value)) {
            var charset = mime.charsets.lookup(value.split(';')[0]);
            if (charset) value += '; charset=' + charset.toLowerCase();
          }
        }
    
        this.setHeader(field, value);
      } else {
        for (var key in field) {
          this.set(key, field[key]);
        }
      }
      return this;
    };